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
 

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
Cookies are required to use this site. You must accept them to continue using the site. Learn more…