Is this a bug in the code of the DBUtils example program?

BlueVision

Member
Licensed User
Longtime User
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
 

BlueVision

Member
Licensed User
Longtime User
The official version of DBUtils is attached to the first post of the DBUtils thread. It is v1.08 and it doesn't include this modification.

I know Erel, thanks for response. But nethertheless the written code for the DBUtils example can't work then as published in actual UsersGuide for two reasons. That missing routine in DBUtils and that bug in the DBUtils example program (to me it looks like a bug). Maybe I have to look for the DBUtils-example program, how it is solved there. So far I tryed to built my program routine by routine following the written examples in the users guide and modified for my needs. Using the inofficial delete-routine and the modified code works for my needs.
It's just a case of making a correction to it, so other users don't have to search that error again and again.

Cheers and thanks for that beautiful piece of software!
 
Upvote 0

BlueVision

Member
Licensed User
Longtime User
@Erel

Correct. But I think this "bug" has more to do with implenting your code into my environment. I haven't done investigation on the whole sample program, is it's simply a routine without the other code, making it work in your sample. Don't worry.

@mc73

Your mean the missing DBUtils.DeleteRecord sub?
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
The example program in the User's Guide does work.
In your program did you define the variable ID in the WebView1_OverrideUrl routine ?
The DBUtils module with the DeleteRecord routine is included in the SQLDBUtils example in the User's Guide SourceCode folder.

Best regards.
 
Upvote 0
Top