I would like to know what are the best way to import EXCEL/CSV/TXT file into MySQL using c#.net Desktop app.
Thanks in advance ..
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Candy BrownPosted Dec 3, 2014, 4:50 AM
There are couple of ways you can do this. Although Imtiyaz's code does not show it, you can use an excel automation in .NET in order to create a DataTable object from the existing excel file, but this can be a rather slow approach and also it will require a MS Excel installed on the machine.
A faster approach would be to use OLEDB for this.
But yes I presume that a LOAD DATA INFILE would have the best performances, but you cannot use it with an excel file because it requires a text file. So if you would first convert your Excel file into a CSV format in C# with something like this .NET component for fast excel processing then you could use it.
TulasiPosted Mar 19, 2013, 1:19 AM
But my question is howto import excel/csv/txt data into MySql ?
i possible way is Using LOAD DATA INFILE query .
is there any other alternative and better approach to insert data into mysql?
Imtiyaz AnsariPosted Mar 18, 2013, 2:36 PM
Microsoft.Office.Interop.Excel.dll
gridview data create excel file :-