Speed up insert mdb

前端 未结 5 1327
抹茶落季
抹茶落季 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:02

    Is it possible for you to use a query that inserts directly from csv? For example:

    SELECT ID,Field1 INTO NewTable 
    FROM [Text;HDR=YES;FMT=Delimited;IMEX=2;DATABASE=C:\Docs\].Some.CSV
    

    You can use something similar with non-standard delimiters, but you will need a Schema.ini file in the same directory as the file to be imported. It need only contain:

    [tempImportfile.csv]
    TextDelimiter='
    

    You will have to alter the connect string slightly, this seems to work:

    Text;HDR=YES;FMT=Delimited;DATABASE=C:\Docs\
    

提交回复
热议问题