Hi There im getting below error. Any Idea why?
I created the List View with designer. But than every time I get Object must be initialized.
so I initialize ListView1 in Activity Create
** Activity (main) Create, isFirst = true **
true
true
** Activity (main) Resume **
100
** Activity (main) Pause, UserClosed = false **
** Activity (update_delivery) Create, isFirst = true **
** Activity (update_delivery) Resume **
(SQLiteCursor) android.database.sqlite.SQLiteCursor@21a20918
Error occurred on line: 187 (dbutils)
android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: (SQLiteCursor) android.database.sqlite.SQLiteCursor@21a20918
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:601)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1317)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1256)
at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:167)
at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:155)
at whse.deliverystatus.dbutils._executememorytable(dbutils.java:513)
at whse.deliverystatus.dbutils._executelistview(dbutils.java:172)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
I created the List View with designer. But than every time I get Object must be initialized.
so I initialize ListView1 in Activity Create
B4X:
If ListView1.IsInitialized = False Then
ListView1.Initialize("ListView1")
End If
** Activity (main) Create, isFirst = true **
true
true
** Activity (main) Resume **
100
** Activity (main) Pause, UserClosed = false **
** Activity (update_delivery) Create, isFirst = true **
** Activity (update_delivery) Resume **
(SQLiteCursor) android.database.sqlite.SQLiteCursor@21a20918
Error occurred on line: 187 (dbutils)
android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: (SQLiteCursor) android.database.sqlite.SQLiteCursor@21a20918
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:601)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1317)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1256)
at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:167)
at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:155)
at whse.deliverystatus.dbutils._executememorytable(dbutils.java:513)
at whse.deliverystatus.dbutils._executelistview(dbutils.java:172)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:302)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
B4X:
Sub Pnl5Bttn5start_search_PO_Click
'Search PO/DO base on PO/DO Number input.
Dim Input As String
Input = Pnl5EdtTxt1PoDo_no.Text
'Search PO/DO base on date input.
Dim Input2 As String
Input2 = Pnl5EdtTxt2PoDo_date.Text
ListView1.Visible = True
'Already declare in Sub Process Global.
'Dim DBFileName As String : DBFileName = "delivery.db"
'Dim DBFilePath As String : DBFilePath = File.DirInternal
'Dim DBTableName1 As String : DBTableName1 = "DeliveryRegister"
'If Input.Length > 0 Then
'select query with where clause
'Input is the search parameter_value for PO/DO Number
Dim Cursor1 As Cursor
'Cursor1 = SQL1.ExecQuery("SELECT DONumber FROM " & DBTableName1& "")
Cursor1 = SQL1.ExecQuery2("SELECT ID, DONumber, DODate, DOReceiveDate, DeliveryAddress, DeliveryDate, OutletName, LineItems, Region, SpecialInstructions, Remarks FROM " & DBTableName1 & " WHERE DONumber= ?", Array As String(Input))
Log(Cursor1)
For i = 0 To Cursor1.RowCount - 1
Cursor1.Position = i
DBUtils.ExecuteListView(SQL1, Cursor1, Null, 0 , ListView1, True)
Log(DBUtils.ExecuteListView(SQL1, Cursor1, Null, Null, ListView1, True))
'username(i)=readqry.GetString("name")'
'userid(i)=readqry.GetInt("userid")
'Log("Select query with where clause: name = " & username(i) & " userid = " & userid(i))
Next