C# ConnectionState用法

   if (myConn.State == ConnectionState.Open)
        {
            myConn.Close();
            myConn.Open();
            myCmd.ExecuteNonQuery();
            myConn.Close();
        }
        else
        {
            myConn.Open();
            myCmd.ExecuteNonQuery();
            myConn.Close();
        } 

你可能感兴趣的:(C#)