You're trying to open a connection which is already open, this results in exception.
Solution 1 (recommended):
Inspect your code, check all the parts where cmd.Connection
connection is opened and ensure that it's always closed properly.
Solution 2 (quick'n'dirty fix):
before line
cmd.Connection.Open();
add the following check/cleanup code:
if (cmd.Connection.State == ConnectionState.Open)
{
cmd.Connection.Close();
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…