Android Question Returning records to a spinner using where clause

Makumbi

Well-Known 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

B4X:
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
 
Top