New topic: nil value for REALSQLDatabase
<http://forums.realsoftware.com/viewtopic.php?t=47386> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message plunkettphoto Post subject: nil value for REALSQLDatabasePosted: Sat Mar 23, 2013 9:08 pm Joined: Fri Oct 10, 2008 7:14 pm Posts: 57 I have the following code in in a Method of a GlobalModule. The subroutine is executed immediately when the app is opened. ................. dim sSQL As String dim rsTW as RecordSet dim dbTW as new REALSQLDatabase dbTW.databaseFile = getFolderItem("").child("Database").child( "TimeWorked.rsd" ) if dbTW.databaseFile.exists then if not dbTW.connect() then MsgBox("Database Connection Error") gDBError = "Y" return end else // dbTW was not found MsgBox("Database Not Found") gDBError = "Y" return end rsTW = dbTW.SQLSelect("SELECT * FROM Admin") return ......................... Debugging/Tracing indicates that it runs properly. I have a global property defined in the GlobalModule: dbTW as REALSQLDatabase In any other module, when I try to use dbTW, an examination of Global Variables show dbTW with a value of nil. Am I missing something basic. thanks, b Top plunkettphoto Post subject: Re: nil value for REALSQLDatabasePosted: Sat Mar 23, 2013 9:12 pm Joined: Fri Oct 10, 2008 7:14 pm Posts: 57 Just realized I had the dim dbTW in the subroutine. When I took it out I get the nil error in the initial global module. Top timhare Post subject: Re: nil value for REALSQLDatabasePosted: Sun Mar 24, 2013 12:07 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 12169 Location: Portland, OR USA Don't just take it out. Replace it with dbTW = New REALSQLdatabase You have to instantiate the object before you can use it. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
