I have problems with reading db sqlite in linux!
how can i solve :-(
how can i solve :-(
Public Sub reload
TableView1.Items.Clear
Try
'-------> load record agent <------------------------------
ListAgent.Initialize
sql1.InitializeSQLite(File.DirApp, "datasqlite.db", True)
RS = sql1.ExecQuery("select * from data2")
Do While RS.NextRow
Dim Row() As Object = Array (RS.GetString("nome"), RS.GetString("cognome"), RS.GetString("phone"), RS.GetString("email"), RS.GetString("code"))
ListAgent.Add(Row)
Loop
RS.Close
'-------> load record client <------------------------------
sql1.InitializeSQLite(File.DirApp, "datasqlite.db", True)
RS = sql1.ExecQuery("select * from data1")
Do While RS.NextRow
'----------------> append note record <--------------------------------
Dim RSR As ResultSet
RSR = sql1.ExecQuery("select * from data3 WHERE relation='" & RS.GetString("phone") & "';")
Do While RSR.NextRow
Dim Row() As Object = Array (RS.GetString("nome"), RS.GetString("cognome"), RS.GetString("indirizzo"), RS.GetString("citta"), RS.GetString("phone"), RS.GetString("email"),RSR.GetString("radio"), RSR.GetString("note"), RSR.GetString("agent"))
Loop
'------------------> public record into tableview <-------------------------------------------
TableView1.Items.Add(Row)
Loop
RS.Close
Catch
Log(LastException)
fx.Msgbox(MainForm,LastException,"Error try")
End Try
End Sub
Sub addmenu(form As Form)
Dim mb As MenuBar
mb.Initialize("")
form.RootPane.AddNode(mb, 0, 0, 0,0)
Dim age As Menu
age.Initialize("Agenti", "")
Dim data As Menu
data.Initialize("Database", "")
Dim plugins As Menu
plugins.Initialize("Moduli", "")
mb.Menus.Add(age)
mb.Menus.Add(data)
mb.Menus.Add(plugins)
Dim mm As MenuItem
mm.Initialize("Agenti", "MenuBar1")
age.MenuItems.Add(mm)
Dim mm As MenuItem
mm.Initialize("Ricarica", "MenuBar1")
data.MenuItems.Add(mm)
If File.IsDirectory(File.DirApp,"plugins") = False Then
File.MakeDir(File.DirApp,"plugins")
End If
Dim l As List = File.ListFiles(File.Combine( File.DirApp,"plugins"))
For i = 0 To l.Size - 1
If isDir(l.Get(i)) = False Then
Dim nameapp,urlapp As String
nameapp = l.Get(i)
nameapp = nameapp.Replace(".jar","")
urlapp = File.Combine(File.Combine( File.DirApp,"plugins"),l.Get(i))
Dim mm As MenuItem
mm.Initialize(nameapp, "MenuBarplugins")
mm.Tag = urlapp
plugins.MenuItems.Add(mm)
End If
Next
End Sub
I'm sorry but I cannot help you as you are not answering my questions...
Call initializedb once in AppStart and comment it out everywhere else it is called (and it is in a lot of places).
public Sub initializedb
Log(File.DirApp)
sql1.InitializeSQLite(File.DirApp, "datasqlite.db", False)
End Sub
The database works fine here.
I've changed your code to:
B4X:public Sub initializedb Log(File.DirApp) sql1.InitializeSQLite(File.DirApp, "datasqlite.db", False) End Sub
I then copied the database file to that path. I guess that you haven't copied it and are opening an empty database each time.
Will need some more info: path of program location, path of database location, rights of program, rights of database, rights of directory containing program and database (rights via ls -l). JDK version used to create program, JRE/JDK that is running program. How are you getting the database to the location?