System.Data.OleDb.OleDbDataAdapter  da;
System.Data.DataSet  ds;
System.Data.DataTable dtSource;
---------------------------------------------------da = new  OleDbDataAdapter (sSql, conn);
ds = new DataSet();
//Fill the DataSet.
da.Fill(ds, "operationDB");
//Set the source table.
dtSource = ds.Tables["operationDB"];每次在执行da.Fill(ds, "operationDB");后内容都回变大查询2000条数据会有20M内存增大,而后每次在电击查询,还有有1-3M的增大。这可怎么办呢?
尝试过
if (ds !=null){ds.Dispose();}
if (da !=null){da.Dispose();}
添加但是没有效果!

解决方案 »

  1.   

    ds = new DataSet();只在加载的时候实例一次吧..
    在da.Fill前先da.Clear();
      

  2.   

    你查询数据为的肯定是要最终在表现层页面展现出来,一个页面每次出现的数据量是一定的。所以采用分页进行处理,具体用存储过程建立临时表,或者找个第三方控件进行分页如果你的ds只是单向的输出,不需要更新。可以用 datareader 输出到 datatable 这样比fill ds 速度要快的多