I am using some modified code from a project I wrote 3 years ago and and having problems with it,
In the App event open I have
[code]// Create Database Object
Dim golfer as RealSQLDatabase
golfer = New REALSQLDatabase
dim f as folderitem = specialFolder.ApplicationData.Child(“TGC”)
if f.exists = false then
f.createasfolder
end
f = f.child(“Golf”)
if f.exists = false then
f.createasfolder
end
f = f.child(“golfer.rsd”)
golfer.DatabaseFile = f
// Set Database File
golfer.DatabaseFile = SpecialFolder.ApplicationData.Child(“TGC”).Child(“Golf”).Child(“golfer.rsd”)
// Connect to the database
if golfer.databaseFile.exists = true then
// The database file already exists, so we want to connect to it.
if golfer.Connect() = false then
DisplayDatabaseError//( false )// there was an error connecting to the database
Quit
return
end if
else
// The database file does not exist so we want to create a new one.
// The process of creating a database will establish a connection to it
// so there isn’t a need to call Database.Connect after we create it.
CreateDatabaseFile
end
// Set the application to AutoQuit, so if all windows are closed then the application
// will quit.
app.autoQuit = true [/code]
I also have 2 Methods
- CreateDatabaseFile
if golfer.CreateDatabaseFile = false then
// Error While Creating the Database
MsgBox "Database Error" + EndOfLine + EndOfLine + "There was an error when creating the database."
Quit
end if
golfer.SQLExecute "CREATE TABLE data(PK INTEGER PRIMARY KEY NOT NULL ,FirstName, Lastname)"
golfer.Commit
- DisplaDatabaseError
MsgBox "Database Error: " + str(golfer.ErrorCode) + EndOfLine + EndOfLine + golfer.ErrorMessage
The problem I am having is with “golfer” in the 2 Methods all instances keep coming up as they don’t exist and I can’t find the problem.
Thanks Shane