相关疑难解决方法(0)

加快插入mdb

有没有办法加快插入到mdb?

 using (StreamReader sr = new StreamReader(_localDir + "\\" + _filename))
  while ((line = sr.ReadLine()) != null)
{
   //sanitize the data
}
Run Code Online (Sandbox Code Playgroud)

对于来自csv的约2mil记录,这需要大约20秒,但是当我添加mdb插入时,我在10分钟内几乎无法获得10,000条记录,因此您可以看到它将永远需要

 using (StreamReader sr = new StreamReader(_localDir + "\\" + _filename))
 while ((line = sr.ReadLine()) != null)
{
//sanitize the data
using (OleDbConnection con = new OleDbConnection(_conStr))
 using (OleDbCommand cmd = new OleDbCommand())
 cmd.Parameters.AddWithValue...//I have 22 params
cmd.ExecuteNonQuery();

}
Run Code Online (Sandbox Code Playgroud)

有没有更好的办法?连接池?线程?这是我的constr Provider = Microsoft.Jet.OLEDB.4.0; Data Source = mypath; Jet OLEDB:Engine Type = 5"

问候

_Eric

c# ms-access

3
推荐指数
1
解决办法
3963
查看次数

标签 统计

c# ×1

ms-access ×1