Hi,
I have a table "mixingstation.db" in the files folder
It consists of 2 tables as shown SqLiteStructure.jpg
my code is - the complete source is in "First1.zip"
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private PbShowTables As Button
Private PbReadTrail As Button
Dim Cursor As ResultSet
Dim SQL1 As SQL
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Logo") 'Load the layout file.
MainForm.Show
SQL1.InitializeSQLite(File.DirApp, "mixingstation.db", True)
'see if the database exists
If File.Exists(File.DirApp,"mixingstation.db") Then
Log("mixingstation.db exists")
Else
Log("mixingstation.db does NOT exist")
End If
End Sub
Sub PbReadTrail_Action
'get the trail data
Cursor = SQL1.ExecQuery("SELECT * FROM Trail")
'gives this error
'java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: Trail)
Cursor.Close
End Sub
Sub PbShowTables_Action
'http://www.b4x.com/b4j/help/jsql.html
'get the tables
Cursor = SQL1.ExecQuery("SELECT name FROM sqlite_master WHERE type = 'table'")
'see if there are any tables
If Cursor.NextRow Then
Log ("There are tables")
Else
Log("There are NO tables")
End If
'see if there are any columns
Log("There is " & Cursor.ColumnCount & " column")
Log("title of first column is " & Cursor.GetColumnName(0))
Cursor.Close
End Sub
when pressing on "Read trail",
this error shows
Program started.
mixingstation.db exists
main._pbreadtrail_action (java line: 70)
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: Trail)
It appears I am reading the data base, but can not read the tables.
Please tell me what I am doing wrong
Thank you
I have a table "mixingstation.db" in the files folder
It consists of 2 tables as shown SqLiteStructure.jpg
my code is - the complete source is in "First1.zip"
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private PbShowTables As Button
Private PbReadTrail As Button
Dim Cursor As ResultSet
Dim SQL1 As SQL
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Logo") 'Load the layout file.
MainForm.Show
SQL1.InitializeSQLite(File.DirApp, "mixingstation.db", True)
'see if the database exists
If File.Exists(File.DirApp,"mixingstation.db") Then
Log("mixingstation.db exists")
Else
Log("mixingstation.db does NOT exist")
End If
End Sub
Sub PbReadTrail_Action
'get the trail data
Cursor = SQL1.ExecQuery("SELECT * FROM Trail")
'gives this error
'java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: Trail)
Cursor.Close
End Sub
Sub PbShowTables_Action
'http://www.b4x.com/b4j/help/jsql.html
'get the tables
Cursor = SQL1.ExecQuery("SELECT name FROM sqlite_master WHERE type = 'table'")
'see if there are any tables
If Cursor.NextRow Then
Log ("There are tables")
Else
Log("There are NO tables")
End If
'see if there are any columns
Log("There is " & Cursor.ColumnCount & " column")
Log("title of first column is " & Cursor.GetColumnName(0))
Cursor.Close
End Sub
when pressing on "Read trail",
this error shows
Program started.
mixingstation.db exists
main._pbreadtrail_action (java line: 70)
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (no such table: Trail)
It appears I am reading the data base, but can not read the tables.
Please tell me what I am doing wrong
Thank you