Speed up insert mdb

前端 未结 5 1325
抹茶落季
抹茶落季 2020-12-19 18:06

Is there a way to speed up inserts to a mdb?

 using (StreamReader sr = new StreamReader(_localDir + \"\\\\\" + _filename))
  while ((line = sr.ReadLine()) !=         


        
5条回答
  •  执笔经年
    2020-12-19 19:04

    Microsoft Jet to handle Sql parsing (INSERT/UPDATE) is slow in general. In other words, you may have the most efficient code possible, but the choke point is Jet. Keep in mind, that in your original posting your connecting (open file, create lock, seek file, insert row, dispose lock, close file, dispose object) for every line. You need to connect ONCE (outside the while), read the lines, generate Sql (OleDbCommand), and then execute.

提交回复
热议问题