开发者

C# - Best (fastest) way to import data from text file to mdf

I need to import data from text file (not separet开发者_如何学Goed by commas, other way, different characters) to database (for example to mdf). Because datagridview loads data from database faster then from file. What is the best way? Thank you


If using SQL Server (which .mdf suggests you are) you could try bulk inserting:

BULK
INSERT MyTable
FROM 'c:\myfile.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)


Maybe the .NET library FileHelpers can do something for you...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜