摘要:
文章代码如下: class Program { static void Main (string[] args) { //连接数据库 string connString = "server=.;database=Student;user id=sa;pwd=123456"; Console.Writ 阅读全文
摘要:
这节接着讲用C#进行数据库CRUD,高级部分。 事务: 事务是执行一批sql语句,如果中途失败,全部回滚,数据不会受影响,中途没有出错则会提交事务,真正对数据进行修改。C#提供了SqlTransaction类来处理数据库事务,下面通过一个示例方法来看一下这个类如何使用: using(SqlConne 阅读全文