Click here to Skip to main content
15,891,748 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How to import data table to mysql table using mysqlbulkloader using c#
C#
 public void SqlBulkCopyImport(DataTable dt,string TableName)
        {
            try
            {
                {
                    con.Open();
                    MySqlBulkLoader bulkCopy = new MySqlBulkLoader(con);
//                    {
                        // Specify the destination table name.
                        bulkCopy.TableName = TableName;
//                        foreach (DataColumn dc in dt.Columns)
//                        {
//                            bulkCopy.colummap.Add(dc.ColumnName, dc.ColumnName);
//                        }
                        // Write from the source to the destination.
                        //how exactly to do this??
//                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                con.Close();
            }
        }
Posted
Comments
DevMostafa 19-Mar-13 11:19am    
Where the class of mysqlbulkloader

 
Share this answer
 
Comments
girish sp 23-Jan-12 23:37pm    
that is about loading from a file,i already have a data table i need to load that table to mysql,may be i have to map columns and then load it,i could do it in sql but no way i could find out in mysql.
VB
Error   7   'colummap' is not a member of 'MySql.Data.MySqlClient.MySqlBulkLoader'.
 
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