Hi all ,
Assume I have myDB.db which has 1 table (myTable) as below
and then I have modify my table (add "D") is
In starter module,I have code as belows
and In another module is
My problem is : After I modified table , my project is not work,it can't see [D] in the code as belows
I think it still remember the old structure of table,doesn't it?
Assume I have myDB.db which has 1 table (myTable) as below
B4X:
CREATE TABLE "myTable" (
"ID" INTEGER,
"A" TEXT,
"B" TEXT,
"C" INTEGER,
PRIMARY KEY("ID" AUTOINCREMENT)
)
and then I have modify my table (add "D") is
B4X:
CREATE TABLE "myTable" (
"ID" INTEGER,
"A" TEXT,
"B" TEXT,
"C" INTEGER,
"D" INTEGER,
PRIMARY KEY("ID" AUTOINCREMENT)
)
In starter module,I have code as belows
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Public SQL1 As SQL
Public DBFileName As String : DBFileName = "myDB.db"
End Sub
Sub Service_Create
'Use the database in the writable location
DBDir =DBUtils.CopyDBFromAssets(DBFileName)
SQL1.Initialize(DBDir,DBFileName, True)
End Sub
and In another module is
B4X:
Sub AddEntry
Dim m As Map
m.Initialize
m.Put("A",Edtext1.Text)
m.Put("B",Edtext2.Text)
m.Put("C",Edtext3.Text)
m.Put("D",Paid) 'Paid is from calculated
Starter.RowIDList.Add(m)
DBUtils.InsertMaps(Starter.SQL1,"myTable", Starter.RowIDList)
End Sub
My problem is : After I modified table , my project is not work,it can't see [D] in the code as belows
B4X:
Sub Button1_Click
DBUtils.DeleteRecord(SQL1,"myTable", CreateMap("ID":Csr.GetInt("ID") ))
WebView1.LoadHtml(DBUtils.ExecuteHtml(SQL1,"SELECT [A] As "A",[B] as "B" ,[C] as "C",[D] as "D" From myTable",Null,0,True))
FWin.Close
End Sub
I think it still remember the old structure of table,doesn't it?