T Tata Mapassa Active Member Licensed User Longtime User Oct 2, 2022 #1 Hello, How to display data from a field (sqlite) in a spinner? Thank you
LucaMs Expert Licensed User Longtime User Oct 2, 2022 #2 If you like... https://www.b4x.com/android/forum/threads/b4x-lmb4xcombobox.116767/#content Upvote 0
M Mahares Expert Licensed User Longtime User Oct 2, 2022 #3 GOMBE said: How to display data from a field (sqlite) in a spinner? Click to expand... This answers your question, but it is better to use B4XComboBox instead of spinner for x Platform Code: Copy 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 Upvote 0
GOMBE said: How to display data from a field (sqlite) in a spinner? Click to expand... This answers your question, but it is better to use B4XComboBox instead of spinner for x Platform Code: Copy 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
T Tata Mapassa Active Member Licensed User Longtime User Oct 2, 2022 #4 I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Thank you for your help Upvote 0
I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Thank you for your help
LucaMs Expert Licensed User Longtime User Oct 2, 2022 #5 GOMBE said: I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Thank you for your help Click to expand... In that first post: Upvote 0
GOMBE said: I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Thank you for your help Click to expand... In that first post:
M Mahares Expert Licensed User Longtime User Oct 2, 2022 #6 GOMBE said: I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Click to expand... Add B4XComboBox1 in the Designer . Make sure XUI Views library is checked Code: Copy Private B4XComboBox1 As B4XComboBox 'in globals, need the XUI Views library checked Code: Copy 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 Upvote 0
GOMBE said: I don't see how to use B4XComboBox with sqlite? I replaced spinner by B4XComboBox and I have errors. Click to expand... Add B4XComboBox1 in the Designer . Make sure XUI Views library is checked Code: Copy Private B4XComboBox1 As B4XComboBox 'in globals, need the XUI Views library checked Code: Copy 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
T Tata Mapassa Active Member Licensed User Longtime User Oct 2, 2022 #7 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 Upvote 0
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
M Mahares Expert Licensed User Longtime User Oct 2, 2022 #8 GOMBE said: the code below works. Thank you : Click to expand... 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: Code: Copy Dim Cur As Resultset Spinner2.Clear Cur = SQL1.ExecQuery("SELECT * FROM Table") do while cur.nextrow Spinner2.Add(Cur.GetString("Field")) loop Cur.Close Upvote 0
GOMBE said: the code below works. Thank you : Click to expand... 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: Code: Copy Dim Cur As Resultset Spinner2.Clear Cur = SQL1.ExecQuery("SELECT * FROM Table") do while cur.nextrow Spinner2.Add(Cur.GetString("Field")) loop Cur.Close