If this should go to the iOS channel please let me know and I will repost. It’s just that this is such a basic question.
Working on 1st iOS app - actually a redesign of existing desktop app for iPad. It requires a single SQLite database. But the database already exists so I don’t need to create the file as the iOS example project demonstrates. But I obviously need to connect to it.
To start out, I created an empty folder in my development area and placed a copy of the SQLite database in the new folder. I created a new iOS project and saved it to the same folder. Same way I work with desktop apps.
Now I think this is really a SCOPE question as much as anything. In the “App” object, inside the “OPEN” event handler, I placed the following code:
Dim dbFile As FolderItem = SpecialFolder.Documents.Child("Masons.sqlite")
dbSQL = New iOSSQLiteDatabase
dbSQL.DatabaseFile = dbFile
Try
If dbSQL.Connect() then
bConnected = True
lblDatabaseStatus.Text = "Created."
End If
Catch e As iOSSQLiteException
bonnected = False
lblDatabaseStatus.Text = "Error: " + e.Reason
End Try
On “View1”, I placed a label and named it “lblDatabaseStatus” and made it PUBLIC. At this point there is nothing else in the project except what was created by starting a new project. I get a compile error that says lblDatabaseStatus.text doesn’t exist. By the way, the above code was copied from the example project with just minor changes.
To recap: dbSQL database file is PUBLIC iOSSQLiteDatabase property of the App object. bConnected is a PUBLIC BOOLEAN property of the App object. lblDatabaseStatus is a PUBLIC iOSLabel property of the View1 object.
The end project is going to have several “Views”, so the database object needs to be global.
Please help me get a basic start on this…
thanks in advance.