Struggling with SQLite and the new API

I’ve tried copying sample code from the online documentation but get various complex errors. Does anyone have example code that works and is willing to share?

Thanks

You’ll need to provide specifics of what you have tried (we need to see code) and what error/problem you experience.

I figured that I would start with a few statements at a time and if they compiled adapt them to my needs. The first 2 statements are:

db = new SQLiteDatabase
db.DatabaseFile = new FolderItem(“test.sqlite”)

When I try to compile I get the following errors.

App.Opening, line 1

This item does not exist

db = new SQLiteDatabase

App.Opening, line 2

This item does not exist

db.DatabaseFile = new FolderItem(“test.sqlite”)

App.Opening, line 2

Type “Int32” has no member named “DatabaseFile”

db.DatabaseFile = new FolderItem(“test.sqlite”)

Maybe start with one of the SQLite sample projects that Xojo includes?

I actually broke down and bought the new ebook from xDev library " I Wish I Knew How to… Program SQLite with Xojo API2" and tried one of the examples. Once I knew it worked I adapted it without using the openfile dialog. Next step is getting data from the database.

Thanks for trying to help.

Very good.

@Eugene_Dakin books are great.

I’m betting from your description that it’s db that doesn’t exist here.

You mean you didn’t declare db? As in:

Var db as SQLiteDatabase

This has nothhing to do with any “new API”, you are simply missing the appropriate declaration.

The first example, Here works fine…

I just copy/paste it in Window1.MouseDown of a project loaded in Xojo 2022r4.1 / Ventura 13.2 / MBP M1.