There may e scenario where you are getting error while establishing connection with the database as connection is already open.
it can be easily solved using
if (mysqlcmd.Connection.State == ConnectionState.Closed)
{
mysqlcmd.Connection.Open();
}
//same for closing the connection
if (mysqlcmd.Connection.State == ConnectionState.Open)
{
mysqlcmd.Connection.Close();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment