New topic: Testing for a database connection
<http://forums.realsoftware.com/viewtopic.php?t=41028> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message tombstone Post subject: Testing for a database connectionPosted: Sun Oct 16, 2011 7:28 pm Joined: Mon Oct 10, 2011 8:08 pm Posts: 18 Is there a way to determine if a database object (e.g., MySQLCommunityServer) has an open connection to a database? In VB6 using ADO you could test by code like the following: Code:If conn.State = adStateClosed Then 'do nothing Else conn.Close Set conn = Nothing End If Is there anything analogous in Real Basic? Also, aside from call the Close method on the database object, is there any other "cleanup" that needs to be performed? Again, in VB6 we'd set the object = Nothing. Thanks! Top timhare Post subject: Re: Testing for a database connectionPosted: Mon Oct 17, 2011 12:18 am Joined: Fri Jan 06, 2006 3:21 pm Posts: 10288 Location: Portland, OR USA There is nothing analogous, but then, it isn't needed. You don't even have to Close your connection, it will all be handled for you. Top Akiland Post subject: Re: Testing for a database connectionPosted: Mon Oct 17, 2011 2:18 am Joined: Tue Jan 04, 2011 3:02 am Posts: 348 Location: Jönköping, Sweden Can't you use: Code:if db.Connect then //Connected else //Disconnected MsgBox db.ErrorMessage end if I think that should connect to the db if not connected and if it can't connect, an error message is shown. _________________ Bixue Kommunikation Dev. iMac 27" (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.7 REAL.Studio Web Edition Top tombstone Post subject: Re: Testing for a database connectionPosted: Mon Oct 17, 2011 5:33 am Joined: Mon Oct 10, 2011 8:08 pm Posts: 18 Easy enough. Thanks for the info! Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 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]
