Click here to Skip to main content
15,558,083 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please let me have some efficint bulk excel file upload and insert into database table at a single go.

You can read all the contents to a DataTable and then use SqlBulkCopy[^] class to insert it into the table.

There are a couple of articles in CP for helping you..
SQL Bulk Copy with C#.Net[^]
Transferring Data Using SqlBulkCopy[^]
Share this answer
The BEST way to do it is to create a stored procedure that accepts one row of data at a time, and then call it from your C# code.

Google is your friend.
Share this answer
Robert Rohde 22-Feb-11 2:26am    
He was asking about efficiency. I think he already tried doing it row by row and this is too slow for him...

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