Android Question Sqlite with Select query

Sreenadh OG

Member
Licensed User
hai all,
I have a database contain id, name, phone, address, email. Now i want to get only name from this table.
My query is ..SELECT * FROM tbl_address WHERE id='" & txt_Id.Text & "'
 

Sreenadh OG

Member
Licensed User
hi,
I am getting error in following code..I want to use two cursor in one event..
B4X:
Sub btnAddList_Click
   Dim cur As Cursor
   Dim cusrsExist As Cursor
   
     Dim getItem As String
     Dim list_add As List
     Dim listId As Int
     list_add.Initialize
     cur=Calculation.Sqlcnn.ExecQuery("Select reason from tbl_reason")  
     For i=0 To cur.RowCount-1
       cur.Position=i
       list_add.Add(cur.GetString("reason"))
     Next   
     cur.Close
     listId=InputList(list_add,"Select An Item",1)
     getItem=list_add.get(listId)
cusrsExist = Calculation.Sqlcnn.ExecQuery2("SELECT items FROM tbl_listing WHERE items = ?", Array As String(getItem))
            cusrsExist.Position=0
            Dim strExist As String
            strExist= cusrsExist.GetString("items") ' Error:CursorIndex OutofBountException
            If strExist = "" Then
                Calculation.Sqlcnn.ExecNonQuery2("insert into tbl_listing(items)values(?)",Array As String(getItem))  
            End If
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
B4X:
  cusrsExist = Calculation.Sqlcnn.ExecQuery2("SELECT items FROM tbl_listing WHERE items = ?", ArrayAsString(getItem))
      if cusrsExist.RowCount > 0 then
      cusrsExist.Position=0
      [..]
 
Upvote 0
Top