Data Base Challenge

MrKim

Well-Known Member
Licensed User
Longtime User
I was responding to a new member coming from a MS Access/VBA background as I did. Using an existing SQLite Db I had for another project I decided to write a barebones DB project.
I realized that what I did could probably be done with NO CODE in Access
This got me thinking about how much code needed to be written to do it.

Can you do it cleaner/simpler/clearer(sic)?
If you think you can, modify this app and post it here.
I am NOT looking for a discussion on the merits of various languages here. Just trying to hone my DB skills.

Thank you everyone for all the help yo have given over the years.
 

Attachments

  • SQLLiteExample.zip
    257.6 KB · Views: 169

Magma

Expert
Licensed User
Longtime User
@MrKim After some changes, downloading needed jar... moving .db file ...run it...

Sorry starting a discussion... what do you mean with clearer code... ?

1) You are using a number (not all) of fields/columns of a table showing, updating, delete them...
2) Update/Save works only at the line/row selected.. You can ask if wanna save or auto-save all the lines/rows...
3) You can put a check for the type - because sqllite as you already know - "will just do the job"...

..your approach i think is good... as for SELECT, update, insert, delete I think are "clear"...
 

aeric

Expert
Licensed User
Longtime User
There are a few areas you can improve the attached project.
1. Use latest SQLite library. I am using sqlite-jdbc-3.36.0.3
2. You don't need to use File.GetFileParent when it is unnecessary
3. Copy the sqlite file from Assets folder

B4X:
'SQL1.InitializeSQLite(File.GetFileParent(File.GetFileParent(File.DirApp)), "persons.db", False)
If File.Exists(File.DirApp, "persons.db") = False Then
    Wait For (File.CopyAsync(File.DirAssets, "persons.db", File.DirApp, "persons.db")) Complete (Success As Boolean)
    Log("Success: " & Success)
End If
SQL1.InitializeSQLite(File.DirApp, "persons.db", False)
4. Use B4XTable
Check some tutorials in this forum
 
Top