cowbird 心有多大,世界有多大

燕八哥 MSN:cowbird2002@hotmail.com

know everything about something and something about everything

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

数据库为9i,数据连接都采用Microsoft Ole DB Provider for Oracle方法,分别使用oleDbDataAdapter和oracleDataAdapter适配器,采用以下代码:
private void Button1_Click(object sender, System.EventArgs e)
  {
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "</br>");
   DataSet dstMe = new DataSet();
   this.oleDbDataAdapter1.Fill(dstMe);
   Response.Write(dstMe.Tables[0].Rows.Count.ToString() + "<br>");
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "<br><br>");
  }

  private void Button2_Click(object sender, System.EventArgs e)
  {
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "</br>");
   DataSet dstMe = new DataSet();
   this.oracleDataAdapter1.Fill(dstMe);
   Response.Write(dstMe.Tables[0].Rows.Count.ToString() + "<br>");
   Response.Write(DateTime.Now.Minute.ToString() + " "+  DateTime.Now.Second.ToString() + "<br><br>");  
  }


性能差异如下:

数据适配器                       8000条数据量                150000条数据量
----------------------------------------------------------------------------------------
oleDbDataAdapter        2秒                                     38秒
oracleDataAdapter        2-3秒                                 31秒

结论如下:
当少量数据的时候(目前测试结果8000条以内),采用oleDbDataAdapter和oracleDataAdapter性能一样;
当大量数据的时候(目前测试结果150000条以外),采用oracleDataAdapter更适合;





 

posted on 2005-01-20 15:32  cowbird  阅读(1730)  评论(4编辑  收藏  举报