That's not compiling, is it? :-)
All your normal code, needs to be in a Function/Method in your types, for starters.
You might change the base type to something like :
perhaps calling Init() from your Create() in the sub-type :
You may also want to test that the db isOpen().
Also, if you want to get rid of some of the "noise", you can use these convenience methods from the query record :
All your normal code, needs to be in a Function/Method in your types, for starters.
You might change the base type to something like :
Type TDatabaseTables Global db:TDBConnection Method Init() If Not db Then db = = LoadDatabase("ODBC", "C2D-Productivity", Null, Null, Null, Null, "C2D-Productivity.dsn") End If ' You need to load a FILE DSN. ' Check that the DB connection has been made If Not db Then DebugLog("Didn't work...") DebugLog("Unable to Open the Database C2D-Productivity.mdb from the FILE DSN C2D-Productivity.dsn") Notify("Unable to Open the Database C2D-Productivity.mdb from the FILE DSN C2D-Productivity.dsn") End Else DebugLog("Connected to the Database C2D-Productivity.mdb from the FILE DSN C2D-Productivity.dsn") End If ' Check if the database has an error on opening If db.hasError() Then errorAndClose(db) End If DebugLog( "Database Loaded") End Method Field query:TDatabaseQuery Field record:TQueryRecord End Type
perhaps calling Init() from your Create() in the sub-type :
Activity.Init()
You may also want to test that the db isOpen().
Also, if you want to get rid of some of the "noise", you can use these convenience methods from the query record :
Activity.ActivityID = record.GetInt(0)