Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to insert data from excel to sql server using Entity Framework, if you have project or any advice please tell me
Posted
Comments

1 solution

Use Open XML for instance
https://msdn.microsoft.com/en-us/library/office/bb448854.aspx[^]

Then you have a very fast and easy way of getting the data

Now as you know Entity framework is just a convenient way to wrap a database into .net object, so you design your recieving table in MSSQLDB for instance then refresh your EF edmx file from database
https://msdn.microsoft.com/en-us/library/vstudio/cc716697(v=vs.100).aspx[^]

Now the rest is looping over your workbook columns, row by row and newing up an entity 'row' from your table and populate it with your date and the add it to the datacontext and execute the savechanges method.
 
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