Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I am trying to import a csv file into a SQL server table.

The table already exists in the database.

I have gone two ways with this and both I hit a problem.

First is I populate a datagridview with the csv file. After I have done this I am stuck with how to populate the WriteToServer within the BulkCopy.

Secondly I could import direct to a DataTable and import from there buit again I am stuck in the getting the CSV file to populate the table.

I need a step by step easy to follow explanation as I have been searching and searching and keep hitting my head against a brickwall that is beginning to hurt now.
Posted
Updated 7-Sep-10 4:05am
v2
Comments
Dalek Dave 8-Sep-10 18:13pm    
Well laid out and understandable question.
Makes a change!

1 solution

Well, In the first case how did you populate your datagridview? Do you have DataTable object around? If so, you can call WriteToServer using DataTable.

See MSDN documentation here
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900