Displaying records from a SQL database

aaronk

Well-Known Member
Licensed User
Longtime User
Hello,

I have a SQL database and I am trying to view the data that is stored in it.

Is there a way to select a record without knowing what is stored in that recorded?

I am normally using the following code to select a item but I want to be able to select a record without know what the id is:

B4X:
SQL1.ExecQuerySingleResult("SELECT device_name FROM settings WHERE id = 2"

For Example, I have 20 records in my database and I want to select the 4th one in the list without using the id number.

Or is there a way to add a autoincrement primary key to each record that will be unique for all records?
 
Last edited:

aaronk

Well-Known Member
Licensed User
Longtime User
Thanks Erel.

Got it working by using:

B4X:
SQL1.ExecNonQuery("CREATE TABLE settings(id INTEGER PRIMARY KEY, device_name TEXT)")

Now each record has a unique key making it easy to select the item.
 
Upvote 0
Top