Sub Button1_Click
Cursor1 = SQL1.ExecQuery2("SELECT id FROM tableName WHERE name = ?",Array As String(EditText1.Text)) ' HOW TO GET "id"
' Cursor will hold ALL values and row which are fetched with this query
For i = 0 To Cursor1.RowCount -1
' Iterate through all Results...
Cursor1.Position = i
' Now get values from the active row
Log($"Record #${i}: ${Cursor1.GetInt("id")}"$)
Next
Log($"Records found: ${Cursor1.RowCount}"$)
' Here only one result is expected....
If Cursor1.RowCount = 1 Then
' set the cursor position
Cursor1.Position = 0
EditText2.Text = $"User ID is ${Cursor1.GetInt("id")}"$
Else
EditText2.Text = $"User ID is unknown... No results found"$
End If
End Sub
Please note that the part
For i = 0 To Cursor1.RowCount -1
' Iterate through all Results...
Cursor1.Position = i
' Now get values from the active row
Log($"Record #${i}: ${Cursor1.GetInt("id")}"$)
Next
is just in there for demonstration/your info.
For your issue only this code is needed
Sub Button1_Click
Cursor1 = SQL1.ExecQuery2("SELECT id FROM tableName WHERE name = ?",Array As String(EditText1.Text)) ' HOW TO GET "id"
' Cursor will hold ALL values and row which are fetched with this query
' Here only one result is expected....
If Cursor1.RowCount = 1 Then
' set the cursor position
Cursor1.Position = 0
EditText2.Text = $"User ID is ${Cursor1.GetInt("id")}"$
Else
EditText2.Text = $"User ID is unknown... No results found"$
End If
End Sub
And if you are wondering about the String-Structures with the $signs...
https://www.b4x.com/android/forum/threads/b4x-smart-string-literal.50135/