我发现在写数据操作类的时候,connection的对象不是总在执行前打开的,例如://第一种情况SqlConnection conn = new Connection(conStr);SqlCommand comm = new SqlCommand(sql,comm);conn.open();comm.ExecuteNonQuery();//第二种情况SqlConnection conn = new Connection(conStr);conn.Open();SqlCommand comm = new SqlCommand();comm.Connection = conn;SqlTransaction trans = conn.BeginTransaction();comm.Transaction = trans;
- 2 回答
- 0 关注
- 1070 浏览
添加回答
举报
0/150
提交
取消