In System.Data.IDbConnection check the State property. This return the System.Data.ConnectionState enum.
Best Regards, Ido Samuelson Senior Consultant Magen - Microsoft Technology Center -----Original Message----- From: Unmoderated discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Eduard Lascu Sent: Tuesday, April 12, 2005 9:58 PM To: [email protected] Subject: [ADVANCED-DOTNET] State of a database connection I recently ran into a problem trying to figure out what is the state of my Oracle database connection object (I refer to Oracle specific classes, but I assume it's the same throughout the entire Framework Class Library). When I get the OracleConnection.State property I obtain ConnectionState.Open even when the connection has actually gone down recently. Executing a command will raise an exception, but I need to check the state of the connection before I go to execute the command. I guess something like the old CDatabase::IsOpen would be great. Did anyone here have implemented an IsDatabaseOpen method that will check the state of the connection? I could issue a dummy SQL statement, such as "select sysdate from dual" or something inside the IsDatabaseOpen method, but I noticed that the error raised can have a different code whether you disable the local network, unplug the cable or just reboot the database server. I checked all the methods offered in the interface and there is little to use to create this functionality. Any idea would be great. TIA =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
