Click here to Skip to main content
Sign Up to vote bad
good
See more: C#
How import excel file into mysql DB using .net c# code
Posted 18 Nov '12 - 19:28


2 solutions

If this is something you'll do only once, consider using EXCEL string functions to generate 'INSERT' statements.
Eg:
A                     | B                  | C                  | D
FOO                   | BAR                | BAZ                | 
12                    | 15                 | Beer               | "INSERT INTO MY_TABLE(FOO, BAR, BAZ) VALUES (" + A2 + ", " + B2 + ", '" + C2 + "');" 
999                   | 4                  | Winw               | "INSERT INTO MY_TABLE(FOO, BAR, BAZ) VALUES (" + A3 + ", " + B3 + ", '" + C3 + "');" 
 
If you need to programatically read an EXCEL file using C#, see this link. Then you can connect to MYSQL and generate insert commands from your C# code.
 
Hope this helps,
Pablo.
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 399
1 Mahesh Bailwal 353
2 Maciej Los 270
3 CPallini 245
4 Rohan Leuva 175
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,194
2 CPallini 3,923
3 Rohan Leuva 3,176
4 Maciej Los 2,633


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid