You try to open a connection that is already open, this throws an exception.
Solution 1 (recommended):
Inspect your code, check all the parts where the connection was opened cmd.Connectionand make sure that it is always properly closed.
Solution 2 (quick'n'dirty fix):
before the line
cmd.Connection.Open();
add the following verification / cleaning code:
if (cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
}
source
share