DbHelper增加了两个Build方法分别构建IDbCommand与IDataParameter,同时增加了接受IDbCommand的接 口,这样做是为了在需要重复执行某个Command时不需要每次都重新构建Command浪费效率,现在可以用Build方法先构建出Command对 象,然后在循环中执行这个command,如下示例。

 1Release of DbHelper 1.2.1IDbHelper helper = new SqliteHelper(this.connection);
 2Release of DbHelper 1.2.1
 3Release of DbHelper 1.2.1IDbCommand insertCommand = helper.BuildCommand(
 4Release of DbHelper 1.2.1   "INSERT INTO Test VALUES(NULL, @num, @r_date, @data)",
 5Release of DbHelper 1.2.1   1, DateTime.Now, new byte[0]);
 6Release of DbHelper 1.2.1
 7Release of DbHelper 1.2.1SQLiteConnection con = new SQLiteConnection();
 8Release of DbHelper 1.2.1con.ConnectionString = this.connection.ConnectionString;
 9Release of DbHelper 1.2.1
10Release of DbHelper 1.2.1con.Open();
11Release of DbHelper 1.2.1
12Release of DbHelper 1.2.1IDbTransaction transaction = con.BeginTransaction(
13Release of DbHelper 1.2.1   IsolationLevel.ReadUncommitted);
14Release of DbHelper 1.2.1insertCommand.Transaction = transaction;
15Release of DbHelper 1.2.1
16

关于DbHelper,请参看:

http://cavingdeep.cnblogs.com/category/37490.html

下载及Announcements

http://dbhelper.tigris.org

相关文章:

  • 2022-01-17
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2021-08-14
  • 2021-08-10
  • 2021-07-21
  • 2022-12-23
  • 2021-10-23
相关资源
相似解决方案