Reputation: 14102
I need to import data from text file (not separeted 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
Upvotes: 1
Views: 2027
Reputation: 40365
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'
)
Upvotes: 2