B4J Question SPinner write a value taken from database

ivanomonti

Expert
Licensed User
Longtime User
how do you populate this code object?

I ask for patience and forgive me, but I've never used it and I can't find reference
 

LucaMs

Expert
Licensed User
Longtime User
Databases have nothing to do with your question.
https://www.b4x.com/android/forum/threads/b4j-scrivere-da-codice-come-in-textfiel.116691/post-729222
1587560593952.png
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
🤪🤪🤪

First, I know that you are referring to a local (PC) SQLite and B4J; you should have specified it.
Second, what is your question? How to fill a Spinner OR how to retrieve data from a DB? To fill a Spinner you have to pass a List of strings to it; how to fill a List from a DB?
by reading data from a database. Search for one of the many examples about this.


B4X:
' Here declare and open SQL1 Sqlite DB

Dim lstTexts As List
lstTexts.Initialize

Dim Cursor As ResultSet
Cursor = SQL1.ExecQuery("SELECT YourFieldName FROM YourTableName")
Do While Cursor.NextRow
    lstTexts.Add(Cursor.GetString(YourFieldName))
Loop
Cursor.Close

Spinner1.SetListItems(lstTexts)

It's enough?

I know that you... know how to use a DB, since you have already asked in recent days how to save a bitmap in a Blob field and you have solved it, so I don't understand what is the problem now.
 
Last edited:
Upvote 0
Top