我在执行非查询时得到这个..调用 ExecuteNonQuery....
clsConnection.ExecuteNonQuery("ADD_CUSTOMERS", CommandType.StoredProcedure, paramList);
异常弹出在cmd.Connection.Open();
这是整个 ExecuteNonQuery
public static void ExecuteNonQuery(string sql, CommandType type, List<SqlParameter> paramList)
try
{
DataAccess.clsConnection clsDB = new DataAccess.clsConnection();
using (SqlConnection cn =clsDB.OpenCon())
{
SqlCommand cmd = new SqlCommand();
cmd = CreateCommand(sql, type, paramList);
cmd.Connection = cn;
cmd.CommandType = type;
cmd.CommandText = sql;
cmd.ExecuteNonQuery();
}