HomeЛюди и блогиRelated VideosMore From: sourav mondal

Import / export database data from / to Excel using ASP.NET and C#

220 ratings | 199666 views
In this post, I explain how to import / export database data from/to Excel file using ASP.NET and C#. Import/export data from/to some common format is a very useful technique for transfer data between two other programs/ system on a different platform. Part 2 : Import / export database data from / to XML using ASP.NET and C#. For Source Code Visit : http://dotnetawesome.blogspot.com/2013/11/how-to-import-export-database-data-from_16.html https://www.youtube.com/watch?v=vDLUc3ZMq3Y Visit Part 1: Import / export database data from / to CSV using ASP.NET and C# For Source Code Visit : http://dotnetawesome.blogspot.com/2013/11/how-to-import-export-database-data-from.html Youtube Link : http://youtu.be/FueG-G83_PM
Html code for embedding videos on your blog
Text Comments (29)
Easton Morgan (7 months ago)
This sample application works great! The only critique I have is when you are referencing Microsoft.Jet.OleDb 12.0 as a provider. I went insane looking for that driver!! It's not anywhere to be found and you cannot implicitly install it so after a day or so of looking for a solution I've simply replaced it with Microsoft.ACE.OleDb 12.0 which IS installed on my machine and will work perfectly fine with both Importing Excel 2016 data and Exporting Excel data without any errors or issues.
gayatri sharmah (8 months ago)
can you make a vedio of converting acces to excel using c#
how to add SQL Connection expect using Entity for connection
Daler Rakhmet-Zade (10 months ago)
Thanks, Sourav!
Kevin Quispe Huacac (11 months ago)
EmployeeData$ error?
Daler Rakhmet-Zade (10 months ago)
Kevin, try to rename Sheet1 to EmployeeData$ inside your Excel File. See 25:52.
Abraham Quarshie (1 year ago)
hi. Pls what of if u want to verify if the data exist in the SQL table before uploading ? @sourav mondal
rocky shah (1 year ago)
sourav mondal how i can update date or time in database?.. it doesn't allowing be to convert to datetime datatype .....any solution sir.....
Narjiss Tadli (1 year ago)
Hey, i didn't find the default.aspx anyone could help please ??
sk 007 (1 year ago)
hey. i want to create a same project but using mvc 2. can you help me with that?
Donna Morris (2 years ago)
Perfect, quick fast, very helpful thank you.
amit alamnur (2 years ago)
hi , i am not using .mdf using sql sever then please tell me the code for import and export please
MD GHOUSE (2 years ago)
EmployeeData$ What its im getting error here
Sidharth Khanna (1 year ago)
Do you solve this error?
Divy (2 years ago)
.Thanks for sharing your expertise Sourav..... it would be great if you can add some audio comments on what you are doing... would help to connect the viewers more with the topic!
Freddie Rice (3 years ago)
There are some drawbacks to OLEDB, for example if you check the generated XLSX file (41:14) you'll notice that cells E8, E10, F2, etc. have a small green triangle that indicates a data type error. Unfortunately you cannot change this with OLEDB. There are some other drawbacks that are listed here: stackoverflow.com/questions/3608248/which-one-is-best-oledb-or-excel-object-or-database#3885915 If you're not effected by those limitations then great, but if you are then you'll need to use some other approach, for example: www.gemboxsoftware.com/support/articles/import-export-dataset-xls-xlsx-ods-csv-html-net
To Mr Sourav Mondal Thanks for your Online Support...it works...
Ahmad Al-Dwairi (3 years ago)
bro what is  MuDatabaseEntities  is it database name or what ?
Free Thinker (2 years ago)
+ahmad dwiri this entity class from (entity framework), it will be created automated when you create the entity framework model.
Ricardo Pizango (3 years ago)
I do not speak much English, but I'll try to explain my problem using translator :D. I need to export a report filled with a dataset to excel. I understand how to put headers but not how to fill it with the database. May someone help me?
Neil Busse (2 years ago)
+Ricardo Pizango Correa (Ripi) It is hard to do with a asp application, but there are plenty of tutorials online to show you how to use the excel COM library.
Divya Sri (3 years ago)
sir im having a doubt.. my mini project is similar to ur video. here i have created data of students and teachers.. suppose there are totally 20 staffs and 200 students. then how to divide 20 groups of students allocating each staff for that each groups?
Oper Share (3 years ago)
Great tutorial Sourav. Thanks for sharing your knowledge.
Arijit Sarkar (3 years ago)
hello sir i am getting an error in this part catch (Exception)                 {                     throw;                 } its saying System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\users\arijit\documents\visual studio 2015\Projects\AspImportExport1\AspImportExport1\ImportDocument\c59b8ba2-a5bd-4c66-8368-ebaa6281c7b8.xlsx'. can you pls help me what its asking me to do????
Kabelo Mayweather (2 years ago)
+Jhonnathan Velásquez Pérez it doesn't work
+Arijit Sarkar Hello, I had the same error, and the problem is in the connection string; you should do this: For Excel 97-2003: "ConString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=\"Excel 8.0;HDR=No;IMEX=1\";", FileName);" For Excel 2007: "ConString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=\"Excel 12.0 Xml;HDR=No;IMEX=1\";", FileName);"
Ashok Thirumalasetty (3 years ago)
Can u tell me which version are you using in that I cannot do the same in 2012
Muhammad Shaikh (4 years ago)
Can u help I want to Bind Value in DropDown List of Excel Sheet Programmatically
Harshal Kalal (4 years ago)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.