Android Question Returning records to a spinner using where clause

Discussion in 'Android Questions' started by Makumbi, Jul 12, 2019 at 6:48 AM.

  1. Makumbi

    Makumbi Active Member Licensed User

    Please help my where clause is not returning any records but after i use this 'Curs=Starter.SQL1.ExecQuery("SELECT Term,Account FROM Terms") iam able to see the records please help me out i wanted to use with the where clause

    Code:
    Sub InitSpinners2
        
    Private i As Int
        
    'Private Query1 As String
        Private Curs As Cursor
        
    'query = "CREATE TABLE SMSlist (Account Text, Names Text,Phone text,Sex, ID INTEGER )"
        'We execute a query for each column and fill the Spinner
        'We use SELECT DISTINCT to have each existing first name in the database only once
        'Query1 = "SELECT DISTINCT Term FROM Terms ORDER BY Term ASC WHERE name = ? "
        
        
    Log(Account.Text)
        Curs=Starter.SQL1.ExecQuery(
    "SELECT Term FROM Terms WHERE Account= '" & Account.Text & "'")
        
    'Curs=Starter.SQL1.ExecQuery("SELECT Term,Account FROM Terms")
        'Curs = Starter.SQL1.ExecQuery2("SELECT Term FROM Terms WHERE Account = ?", Array As String(Account.Text))
        'If Cursor2.RowCount=0 Then
        'Curs = Starter.SQL1.ExecQuery(Query1)
        'we add 'no filter' as no selection
        Spinner1.Clear
        Spinner1.Add(
    "Select from the List...")
        
        
    'we fill the Spinner with the data from the database
        For i = 0 To Curs.RowCount - 1
            Curs.Position = i
            
    'spnFirstName.Add(Curs.GetString("Account"))
            Spinner1.Add(Curs.GetString("Term"))
            
    Log(Curs.GetString("Term"))
            
    Log(Curs.GetString("Account"))
            
    'Dim kk As String = Curs.GetString("Names")
            'Log(kk)
        Next
        
    'spnFirstName.RemoveAt("Select from the List...")
        Curs.Close
        
    End Sub
     
  2. klaus

    klaus Expert Licensed User

    Are you sure that the text in Account.Text matches records in the database?
    What is the value of Curs.RowCount?
     
    Makumbi likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice