When i try to run the code below, I get an error that - cur = SQL.ExecQuery(Query), from DBUtils Module needs to be Initialized first.
Heres my code:
Here is error log:
Thanks,
John
Heres my code:
B4X:
Sub InitializeCurrentWeek()
Dim values() As String
Activity.LoadLayout("AddTime")
DisplayWeek.Initialize(Me, "DisplayWeek", 0)
DisplayWeek.AddToActivity(pnlAddTime, 0, 10%y, 100%x, 22%y)
DisplayWeek = DBUtils.ExecuteMemoryTable(sqlCWeek, "SELECT * FROM tblCurrentWeek", Null, 0)
values = DisplayWeek.Get(0)
Log(values(0))
'DisplayWeek.LoadTableFromCSV(File.DirAssets, "tblCurrentWeekJobs.csv", True)
DisplayWeek.SetColumnsWidths(Array As Int(130dip, 130dip, 130dip, 130dip, 130dip, 130dip, 130dip, 130dip))
lblDisplayedWeek.Text = "Current Week"
lblSelectedName.Text = sSelectedName
lblEmployeeID.Text = sEmployeeID
ChangeHeaders
End Sub
Here is error log:
B4X:
dbutils_executememorytable (B4A line: 138)
cur = SQL.ExecQuery(Query)
java.lang.RuntimeException: Object should first be initialized.
at anywheresoftware.b4a.sql.SQL.checkNull(SQL.java:40)
at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:94)
at mcdal.timeclock.dbutils._executememorytable(dbutils.java:625)
at mcdal.timeclock.main._initializecurrentweek(main.java:1075)
at mcdal.timeclock.main._btnaddtime_click(main.java:405)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:158)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:54)
at android.view.View.performClick(View.java:3538)
at android.view.View$PerformClick.run(View.java:14330)
at android.os.Handler.handleCallback(Handler.java:608)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4977)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Object should first be initialized.
Thanks,
John