摘要: ADO.NET 在操作数据库的时候也提供的事务机制一个事物可以用连接的开始事务方法初始化1 SqlConnection conn = new SqlConnection(ContshDBConnStr)2 conn.Open();3 SqlTransaction tran = conn.BeginTransaction();然后就可以把 多个 SqlCommand对象放在此事务对象里.SqlCommand comm = new SqlCommand(SqlSel, conn); comm.Transaction = tran;然后就可以放在 Try { tran.Commit(); } ca. 阅读全文
posted @ 2013-03-08 10:31 不要用我的二来伤害我 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1.在下载.NET环境的SQLite的 DLL(System.Data.SQLite.DLL{ 属性里 复制到本地=true }; System.Data.SQLite.Linq.DLL) 。下载好后添加引用到项目里!2.下载在FireFox的插件 SQLite Manager 后安装在 工具栏里 启动SQLite Manager 在Excute SQL 里利用T-SQL 新建 SQLite 数据库。3.在程序里的APP_DATA里添加建好的数据库 { 属性里 复制到输出目录=true }。4. using System.Data.SQLite 后用 SQLiteConnection 打开连接 阅读全文
posted @ 2013-03-06 21:55 不要用我的二来伤害我 阅读(314) 评论(0) 推荐(0) 编辑
摘要: 首先写一个接口IDBhelper(定义各种增删改查操作方法)。本例用了 SQLSERVER + ACCESS 。然后新建 SQLhelper 类和 ACChelper 类 分别实现 IDBhelper 接口。然后根据参数判断实例化 SQLhelper 类 还是 ACChelper 类 后赋给 IDBhelper 接口类型的变量 。通过此变量调用相应的方法操作相应的数据库。 阅读全文
posted @ 2013-03-06 15:38 不要用我的二来伤害我 阅读(169) 评论(0) 推荐(0) 编辑
摘要: <?xml version="1.0" encoding="utf-8"?><!-- 有关如何配置 ASP.NET 应用程序的详细消息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --><configuration> <system.web> <compilation debug="true" targetFramework="4.0" /> <httpHandlers > <!-- 阅读全文
posted @ 2013-01-14 12:28 不要用我的二来伤害我 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 由于单条的SQL语句在执行时会隐式启动事务(每次执行一次都是打开关闭一次)所以在循环中有大量的 INSERT UPDATA DELETE操作的时候 可以在循环外面 显示启动事务执行效率会大大提高 阅读全文
posted @ 2013-01-11 11:22 不要用我的二来伤害我 阅读(290) 评论(0) 推荐(0) 编辑
摘要: <system.web> <compilation debug="true" targetFramework="4.0" /> <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/> <!--Forms验证分两步 第一步 authentication 为认证 第二部 authorization 为授权--> <!--设置 Forms 认证方式--> <auth 阅读全文
posted @ 2012-12-27 08:55 不要用我的二来伤害我 阅读(350) 评论(1) 推荐(1) 编辑
摘要: 关于LINQ中的分组运算 :下面语句的功能为 按照部门分组 然后统计每个部门的平均分最后显示 部门 和 平均分 两列 1 var query = from t in list group t by t.dep into tt select new { tt.Key, Point = tt.A... 阅读全文
posted @ 2012-12-26 15:12 不要用我的二来伤害我 阅读(227) 评论(0) 推荐(0) 编辑