I think the first thing that should be addressed is, why would a connection be open for 8 hours straight?
I'd think that in most cases you'll connect to the database, do your thing, and close it:
using (var conn = new MySqlConnection(connString))
{
// do what you need here
}
The using block will create a connection which is only valid within the block. When the block ends, the Dispose method will be called on the connection and close and properly dispose of the connection object. This will prevent your application from using up available connections when they aren't needed.
If you are in a situation where you'll need to determine if the connection is open, your connection variable will have a State
property which will be a ConnectionState enumeration.
You can check it using something like this:
if (conn.State != ConnectionState.Open)
{
conn = new MySqlConnection(connString);
}
Hope that helps.