The connection was not closed the connection's current state is open

后端 未结 5 973
太阳男子
太阳男子 2020-11-30 10:56

How to fix this problem; connection already closed in my function:

SqlConnection con=new SqlConnection(@\"Here is My Connection\");

public void run_runcomma         


        
5条回答
  •  难免孤独
    2020-11-30 11:08

    Your connection string is opened. You can use code to check it:

    if(cmd.Connection.State != ConnectionState.Open) cmd.Connection.Open();
    

提交回复
热议问题