SQLExample program throws up errors

Andras

Active Member
Licensed User
Longtime User
Reluctantly moving from CSV files to .DB, I find that the SQLExample program stalls on the following:

pnlToolBox.Top=Activity.Height-pnlToolBox.Height

Commenting the statement out throws up further similar errors in the same Sub.

I presume that something hasn't been initialised, but what? Or am I just being a bit slow here?

John
 

Andras

Active Member
Licensed User
Longtime User
Yes - the section around pp 150 or so in the Beginners' Guide, and the sample included in the downloaded information.

John
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Oh dear! We seem to have the famous unrepeatable error! After giving the same error message four times in a row previously it now works perfectly, and I feel rather silly!

It must have been feeling lazy on Monday! Thanks for your help!

John
 
Upvote 0

Andras

Active Member
Licensed User
Longtime User
I'm continuing to have problems here, probably because I've misunderstood something fundamental!

I'd assumed that the data which is displayed in the SQL Example program is that which is contained in the persons.db file associated with it, and that therefore changing the contents of that data file in SQLite would change what appears in the SQL Example program.

Not so, however! Changes made with SQLite to the persons.db file have no effect on the data displayed in the program, and changes made when the program is running do not appear in the file.

Clearly the real data is being stored somewhere else! Where?

John
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
If you edit the DB using an SQLite editor it will save the data to the DB, BUT, it won't show up on the app, that's because the DB is embedded on the app and if you look at the code you will see that the DB will be created IF IT DOESN'T EXISTS, so, you will have to uninstall the app and then reinstall it in order to clear ALL files.

B4X:
If File.Exists(File.DirDefaultExternal, "SomeDatabase.db") = False Then
            
   File.Copy(File.DirAssets, "SomeDatabase.db", File.DirDefaultExternal, "SomeDatabase.db")
                     
End If

The code above is an example, the "SomeDatabase.db" will be copied from the assets directory to the device if it doesn't exist, but, if you modify the DB manually not from within the app it won't copy it because already exists, therefore, any changes will not show up.
 
Last edited:
Upvote 0

Andras

Active Member
Licensed User
Longtime User
Brilliant - fixed it! I'd misunderstood the purpose of the Copy command, but all is now clear. Thanks!

John
 
Upvote 0
Top