Hi,
using DBUtils for making my first steps into SQLlite. The btnDelete_Click routine in that example program gave me headache today. For making it work I had to search for the DeleteRecord routine of DBUtils, which is not included in the current set, but I found the code here in the forum. This routine works ok, but in my opinion, there is a bug in the routine of the example program, making it impossible do use the DBUtils routine.
Original code (snippet, not complete):
...
If Answ = DialogResponse.POSITIVE Then
Dim mp As Map
Dim val(5) As String
mp.Initialize
mp.Put("ID", ID)
val = lstTable.Get(row)
mp.Put("FirstName", val(1))
mp.Put("LastName", val(2))
mp.Put("Address", val(3))
mp.Put("City", val(4))
DBUtils.DeleteRecord(Main.SQL1, Main.DBTableName, mp)
...
this does not work, ID never gets an other value than zero when I run the code, only difference in my case is a larger map. I modified the lines and it worked for me. Is there a reason I can't see at the moment or is it simply a coding bug? Must say, that I don't had a look into the example program itself, maybe there is a cause for it.
my modified code:
...
If Answ = DialogResponse.POSITIVE Then
Dim mp As Map
Dim val(5) As String
mp.Initialize
val = lstTable.Get(row)
mp.Put("ID", val(0))
mp.Put("FirstName", val(1))
mp.Put("LastName", val(2))
mp.Put("Address", val(3))
mp.Put("City", val(4))
DBUtils.DeleteRecord(Main.SQL1, Main.DBTableName, mp)
...
Am I right?
BTW. Isn't it possible to put the complete DBUtils at a central place, for making updating the code easier to it's newest version? With libraries it is so easy, but with a code-module like DBUtils it takes a lot of time finding the most actual version...
Cheers BV
using DBUtils for making my first steps into SQLlite. The btnDelete_Click routine in that example program gave me headache today. For making it work I had to search for the DeleteRecord routine of DBUtils, which is not included in the current set, but I found the code here in the forum. This routine works ok, but in my opinion, there is a bug in the routine of the example program, making it impossible do use the DBUtils routine.
Original code (snippet, not complete):
...
If Answ = DialogResponse.POSITIVE Then
Dim mp As Map
Dim val(5) As String
mp.Initialize
mp.Put("ID", ID)
val = lstTable.Get(row)
mp.Put("FirstName", val(1))
mp.Put("LastName", val(2))
mp.Put("Address", val(3))
mp.Put("City", val(4))
DBUtils.DeleteRecord(Main.SQL1, Main.DBTableName, mp)
...
this does not work, ID never gets an other value than zero when I run the code, only difference in my case is a larger map. I modified the lines and it worked for me. Is there a reason I can't see at the moment or is it simply a coding bug? Must say, that I don't had a look into the example program itself, maybe there is a cause for it.
my modified code:
...
If Answ = DialogResponse.POSITIVE Then
Dim mp As Map
Dim val(5) As String
mp.Initialize
val = lstTable.Get(row)
mp.Put("ID", val(0))
mp.Put("FirstName", val(1))
mp.Put("LastName", val(2))
mp.Put("Address", val(3))
mp.Put("City", val(4))
DBUtils.DeleteRecord(Main.SQL1, Main.DBTableName, mp)
...
Am I right?
BTW. Isn't it possible to put the complete DBUtils at a central place, for making updating the code easier to it's newest version? With libraries it is so easy, but with a code-module like DBUtils it takes a lot of time finding the most actual version...
Cheers BV