I’m using Visual c# express 2008.
I have a huge text file that has data similar to this: “text/text/text/text”
I’m using a delimiter to separate the data.
Now I want to transfer this data to an .sdf file that will be displayed in table format through the windowsformapplication using dataGridView.
I already created an sdf with a table (and columns).
I know how to access the .sdf and display through the dataGridView.
My problem is I have no idea how to transfer the data from the txt to the sdf.
I don’t want to do it manually because the txt file contains around 20,000 worth of lines.
Resources: I’ve recycled code from
http://dotnetperls.com/datagridview-tutorial
Thanks to anyone who can help. :3 Ree
From memory (not tested) SqlBulkCopy works with SDF, so then all you need is an IDataReader. If you search for “fast CsvReader” you should find one on codeproject; this works with any delimiter and should work perfectly with SqlBulkCopy (I’ve used it this way multiple times, although not with sdf).
http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx
http://www.codeproject.com/KB/database/CsvReader.aspx