SQLite to ListView

gobblegob

Member
Licensed User
Longtime User
Good day everyone. I am wanting to add all items in a SQLite DB to a ListView.
I can get one result only with this code...

B4X:
ListView1.AddSingleLine(SQL1.ExecQuerySingleResult("SELECT col1 FROM table1"))

but i cannot workout how to show every item in the DB col1 in a ListView. :BangHead:

can anyone please help me i have spent almost 7 hours and have almost no code

embarrassed Waz.
 

Merlot2309

Active Member
Licensed User
Longtime User
Hello,

Did you search in the examples? There are some and this should do the job without using DBUtils:

Dim a Cursor and
B4X:
crNames = SQL1.ExecQuery("SELECT Name FROM Table ORDER BY Naam ASC")
   End If
         For i = 0 To crNames.RowCount - 1
            crNames.Position = i
            Listview.AddSingleLine(crNames.GetString("Name"))
         Next

Succes,
Helen.
 
Upvote 0

gobblegob

Member
Licensed User
Longtime User
Thanks guys, I did try DBUtils but i couldnt get it to work.
Thanks Helen that worked perfectly. I did read through all tutorials
but the problem with a lot of tutorials in B4A i find are a bit complex for a beginner or maybe it is just me.

Thankyou very much for your help
:sign0188:

Waz.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…