I want to read an existing data base and display some fields in text labels.
I created a data base with SQLightDatabaseBrowser and made a small test program. But I got already an error opening the data base file.
I only need to access a data base file and read the content, I don't want to create or change anything.
What's wrong? Do I have to create the data base with another program? What is the code to display the contend of a cell? (Like in the db_test sample)?
I created a data base with SQLightDatabaseBrowser and made a small test program. But I got already an error opening the data base file.
I only need to access a data base file and read the content, I don't want to create or change anything.
What's wrong? Do I have to create the data base with another program? What is the code to display the contend of a cell? (Like in the db_test sample)?
B4X:
ub Process_Globals
Dim SQL1 As SQL
End Sub
Sub Globals
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private Label4 As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Main")
SQL1.Initialize(File.DirAssets, "Persons.db", True)
Label1.Text = "Name nr.: " '$ 'Index 2 from Persons.db
Label2.Text = "First name: " '$ 'First name 2 from Persons.db
Label3.Text = "Name: " '$ 'Name 2 from Persons.db
Label4.Text = "Nick name: " '$ 'Nick name 2 from Persons.db
End Sub