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

后端 未结 5 962
太阳男子
太阳男子 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:14

    Check the connection state before opening it:

    if (con.State != ConnectionState.Open)
        con.Open(); 
    

提交回复
热议问题