Hi there...
I am using Jackess Library... seems is the best for using mdb files databases...
so..
With northwind.mdb database tried to read it - write it all works super...
but with my database seems something goes wrong... not know what....
the database made with access 2003, tried with 2007 too - the same..
i am getting the following error:
My code is above:
i am uploading the mdb file too... into zip file will see it.. (scroll down to download whole project)
I am using Jackess Library... seems is the best for using mdb files databases...
so..
With northwind.mdb database tried to read it - write it all works super...
but with my database seems something goes wrong... not know what....
the database made with access 2003, tried with 2007 too - the same..
i am getting the following error:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
java.lang.IllegalArgumentException: Given rowId is invalid: -1:-1
at com.healthmarketscience.jackcess.Table.requireValidRowId(Table.java:2138)
at com.healthmarketscience.jackcess.Table.updateRow(Table.java:1556)
at com.healthmarketscience.jackcess.Cursor.updateCurrentRow(Cursor.java:664)
at com.healthmarketscience.jackcess.Table.updateCurrentRow(Table.java:1541)
at anywheresoftware.b4a.objects.JackcessDatabase$JackcessTable.UpdateCurrentRow(JackcessDatabase.java:422)
at magma.apografh.main._timer1_tick(main.java:499)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
java.lang.IllegalArgumentException: Given rowId is invalid: -1:-1
My code is above:
B4X:
File.Copy(File.DirAssets, "apografh.mdb", File.DirRootExternal, "apografh.mdb")
Access.Open(File.DirRootExternal & "/apografh.mdb")
Table.Initialize(Access.GetTable("apothikieidwn"))
Table.Reset
IndexNames = Table.GetIndexNames
For i = 0 To IndexNames.Length -1
Index.Initialize(Table.GetIndex(IndexNames(i)))
Next
Index.Initialize(Table.GetIndex("barcode"))
BARCODE = EditText1.text
EditText1.text = ""
Cursor.Initialize(Table.GetTable, Index.GetIndex)
Before=Found
'seems ok here!
Found = Cursor.FindFirstRowByEntry(Array As Object(BARCODE))
If Found Then
'finds the record ... !!! is ok
Label3.text = "found it !"
'Label5.text = Cursor.GetColumnValue("....a field 2")
Dim p As Double
p=EditText2.text
If Before=Found Then
p=Cursor.GetColumnValue("APOGRAFH")+1
EditText2.Text = p
p = EditText2.text
Cursor.SetCurrentRowValue("APOGRAFH",p)
Else
If Cursor.GetColumnValue("APOGRAFH")=0 Then
EditText2.Text = "1"
Else
EditText2.Text = Cursor.GetColumnValue("APOGRAFH")
End If
p = EditText2.text
Cursor.SetCurrentRowValue("APOGRAFH",p)
End If
'the problem seems here... but not know what is it ?
Table.UpdateCurrentRow(Array As Object(BARCODE))
Else
EditText2.Text = "0"
Label3.Text = "not found BARCODE!"
Label5.Text = "N/A"
End If
i am uploading the mdb file too... into zip file will see it.. (scroll down to download whole project)
Last edited: