Create table

When I execute this code, a sqlite database gets created in the desired folder (variable points to Application Support), but upon check no table exists/is created in the database and no errors arise (it does execute the db.SQLexecute statement). Anybody got a clue ?

Dim dbFile As New FolderItem(DBPath.Child(“comicDB.sqlite”))
//dbpath points to Application Data on Mac
Dim db As REALSQLDatabase
db = New REALSQLdatabase
db.DatabaseFile = dbFile

If db.CreateDatabaseFile Then
Dim sqlString As String
sqlString = “CREATE TABLE ComicView (comicID INTEGER, comicTitel TEXT, comicDate DATE, comicCover BLOB, PRIMARY KEY(comicID));”
db.SQLExecute(sqlString)
if db.error then
MsgBox(db.ErrorMessage)
end if
Else
MsgBox("Database error: " + db.ErrorMessage)
End If

Change your code to…

if db.error then
  MsgBox(db.ErrorMessage)
else
  db.Commit
end if

But you could also just change

Dim db As REALSQLDatabase
db = New REALSQLdatabase

to

Dim db As New SQLiteDatabase

It is actually recommended to use SQLiteDatabase rather than REALSQLDatabase. Then you don’t have to do a manual commit.

Ah… quick check… it worked. I will use the SQLliteDatabase… Thanks

Jy is welkom.

Suidafrikaan?

Yes. I follow the Dutch Xojo channel every now and then. With some concentration I can understand about 80% of Dutch.

Very good… we look to Afrikaans like our language was say 300 years ago. Some things are different because of other influences like your double denial…

If we see it in written form we tend to consider it as funny… no offense.

No offense taken :wink:

The double denial is a very strange language rule indeed. Not sure how that rule came about, with Afrikaans having its origin from Dutch speaking settlers.

I thought it were the French who introduced this… Je ne sais pas…