This answers your question, but it is better to use B4XComboBox instead of spinner for x Platform
B4X:
strQuery = $"SELECT country FROM mytable ORDER BY country"$
Dim rs As ResultSet = SQL1.ExecQuery(strQuery)
Do While rs.NextRow
spinner.Add(rs.GetString("country") )
Loop
rs.Close
Add B4XComboBox1 in the Designer . Make sure XUI Views library is checked
B4X:
Private B4XComboBox1 As B4XComboBox 'in globals, need the XUI Views library checked
B4X:
strQuery = $"SELECT country FROM mytable ORDER BY country"$
Dim rs As ResultSet = SQL1.ExecQuery(strQuery)
Do While rs.NextRow
B4XComboBox1.cmbBox.Add(rs.GetString("country") )
Loop
rs.Close
If you continue to have problems, post your code. You will get corrected and helped
the code below works. Thank you :
Dim Cur As Cursor
Spinner2.Clear
Cur = SQL1.ExecQuery("SELECT * FROM Table")
For I = 0 To Cur.RowCount - 1
Cur.Position = I
Spinner2.Add(Cur.GetString("Field"))
Next
Cur.Close
That's good that you got it. However you need to note a couple of things:
1. Use code tags when you post lines of code. It looks better and easier to follow.
2. It is preferable to use Resultset than cursor. So your code becomes:
B4X:
Dim Cur As Resultset
Spinner2.Clear
Cur = SQL1.ExecQuery("SELECT * FROM Table")
do while cur.nextrow
Spinner2.Add(Cur.GetString("Field"))
loop
Cur.Close