Is there a way to speed up inserts to a mdb?
using (StreamReader sr = new StreamReader(_localDir + "" + _filename))
while ((line = sr.ReadLine()) != null)
{
//sanitize the data
}
This takes about 20sec for ~2mil records from a csv
but when I add in the mdb insert I can barely get 10,000 records in 10min, so you can see it'll take forever
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();
}
Is there a better way? Connection pooling? threading?
Here is my constr Provider=Microsoft.Jet.OLEDB.4.0;Data Source=mypath;Jet OLEDB:Engine
Type=5"
Regards
_Eric
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…