Android Question How do i link sql to b4xTable

Scantech

Well-Known Member
Licensed User
Longtime User
I can't initialize the .db (database)

B4X:
        If FirstTime Or blnFileAvailable = False Then
            'check external first
            If File.Exists(File.DirRootExternal, Starter.DiagReportDatabase & "diagreport.db") Then
                B4XTable1.sql1.Initialize(File.DirRootExternal, Starter.DiagReportDatabase & "diagreport.db", False)
                blnFileAvailable = True
            Else If File.Exists(File.DirInternal, Starter.DiagReportDatabase & "diagreport.db") Then
                B4XTable1.sql1.Initialize(File.DirInternal, Starter.DiagReportDatabase & "diagreport.db", False)
                blnFileAvailable = True
            Else
                blnFileAvailable = False
            End If
        End If



When I delete a row in b4xTable, I need the .db file to be updated and the row removed from b4xTable. Can i link SQL .db to b4xTable?

I do use the B4XTable1.SetData(Data) but deleting part is where i am struggling
 
Last edited:

Scantech

Well-Known Member
Licensed User
Longtime User
I did that. I have a database file that is initialized with SQL. I am dealing with 2 SQL since i can't link my database file to b4xTable i am doing this for deleting rows at b4xTable and updating SQL. Its working good so far. But i don't like the idea of 2 different SQL.

B4X:
            Starter.sql1.ExecNonQuery2("DELETE FROM diagnosticlog WHERE ID = ?", Array(RowId))
            B4XTable1.sql1.ExecNonQuery2("DELETE FROM data WHERE rowid = ?", Array (RowId))
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
is this .DiagReportDatabase a prefix?
Starter.DiagReportDatabase & "diagreport.db"
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
this works? because the path and name is a separated parameter here
File.Exists(Dir,FileName)
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…