I cannot get the B4atable.setdata to work. I have looked all through the postings and found references to others with the same issue but not with an answer.
I started with a sample project from this site.
I defined the table as follows
B4XTable1.Initialize(Me,"B4XTable1")
'create the columns
B4XTable1.AddColumn("sequence", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("quantity", B4XTable1.COLUMN_TYPE_numbers)
B4XTable1.AddColumn("weight", B4XTable1.COLUMN_TYPE_numbers)
I then pull data from a SQL Server Database which works so rs has data in it.
I have tried a bunch of different ways to add the data from each row to the list and have been successful. You can see by the commented lines I have tried adding it to the list as the
entire row, as an array, as csv variables etch.
The list accepts the add.
But no matter what I do when I try to apply the list to the b4xtable using .setdata I get the following error which looks like it is coming from the b4xtable library.
'********************************************************************
Error occurred on line: 705 (B4XTable)
android.database.sqlite.SQLiteException: near ")": syntax error (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE data )
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1045)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:652)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:61)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:33)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1919)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1841)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:74)
at b4a.example.b4xtable._createtable(b4xtable.java:2417)
at b4a.example.b4xtable$ResumableSub_SetData.resume(b4xtable.java:500)
at b4a.example.b4xtable._setdata(b4xtable.java:433)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.b4xmainpage._loadlist(b4xmainpage.java:393)
at b4a.example.b4xmainpage$ResumableSub_SQLC_DataArrival.resume(b4xmainpage.java:564)
at b4a.example.b4xmainpage._sqlc_dataarrival(b4xmainpage.java:459)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:938)
'*********************************************************************
I have downloaded the most recent release of B4A and I still get the error. If anyone has any idea how to fix this I would appreciate a response.
Thanks
Sub LoadList
Dim ts As String
Dim rs As JdbcResultSet
Dim ll As List
ll.Initialize
ts = "select sequence, quantity, weight from inventory where shipment = '00074195'"
rs = jsqlm.RunQuery(ts )
Do While rs.NextRow
ll.Add(rs)
' ll.Add(Array(rs.GetString("Sequence")))
' 'll.Add (Array As String (rs.GetString ("Sequence"),rs.GetString ("Quantity"),rs.GetString("Weight")))
' Log(rs.GetString("Sequence"))
Loop
Wait for (B4XTable1.SetData(ll)) Complete (Unused As Boolean)
B4XTable1.refresh
I started with a sample project from this site.
I defined the table as follows
B4XTable1.Initialize(Me,"B4XTable1")
'create the columns
B4XTable1.AddColumn("sequence", B4XTable1.COLUMN_TYPE_TEXT)
B4XTable1.AddColumn("quantity", B4XTable1.COLUMN_TYPE_numbers)
B4XTable1.AddColumn("weight", B4XTable1.COLUMN_TYPE_numbers)
I then pull data from a SQL Server Database which works so rs has data in it.
I have tried a bunch of different ways to add the data from each row to the list and have been successful. You can see by the commented lines I have tried adding it to the list as the
entire row, as an array, as csv variables etch.
The list accepts the add.
But no matter what I do when I try to apply the list to the b4xtable using .setdata I get the following error which looks like it is coming from the b4xtable library.
'********************************************************************
Error occurred on line: 705 (B4XTable)
android.database.sqlite.SQLiteException: near ")": syntax error (code 1 SQLITE_ERROR): , while compiling: CREATE TABLE data )
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1045)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:652)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:61)
at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:33)
at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1919)
at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1841)
at anywheresoftware.b4a.sql.SQL.ExecNonQuery(SQL.java:74)
at b4a.example.b4xtable._createtable(b4xtable.java:2417)
at b4a.example.b4xtable$ResumableSub_SetData.resume(b4xtable.java:500)
at b4a.example.b4xtable._setdata(b4xtable.java:433)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
at b4a.example.b4xmainpage._loadlist(b4xmainpage.java:393)
at b4a.example.b4xmainpage$ResumableSub_SQLC_DataArrival.resume(b4xmainpage.java:564)
at b4a.example.b4xmainpage._sqlc_dataarrival(b4xmainpage.java:459)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
at anywheresoftware.b4a.BA$2.run(BA.java:395)
at android.os.Handler.handleCallback(Handler.java:938)
'*********************************************************************
I have downloaded the most recent release of B4A and I still get the error. If anyone has any idea how to fix this I would appreciate a response.
Thanks
Sub LoadList
Dim ts As String
Dim rs As JdbcResultSet
Dim ll As List
ll.Initialize
ts = "select sequence, quantity, weight from inventory where shipment = '00074195'"
rs = jsqlm.RunQuery(ts )
Do While rs.NextRow
ll.Add(rs)
' ll.Add(Array(rs.GetString("Sequence")))
' 'll.Add (Array As String (rs.GetString ("Sequence"),rs.GetString ("Quantity"),rs.GetString("Weight")))
' Log(rs.GetString("Sequence"))
Loop
Wait for (B4XTable1.SetData(ll)) Complete (Unused As Boolean)
B4XTable1.refresh