locked
FoxPro DBF Table Into MySQL Table C# RRS feed

  • Question

  • I'm attempting to select the columns I want from a FoxPro DBF table and insert them into a MySQL table, preferably (if possible) creating the SQL Table on the fly from the columns I've chosen.

    I've had a look and I unserstand this is probably going to be built around the SQL Statement `"SELECT INTO FROM"` but I'm unsure how I would do this, especially programatically within C# and especially scenes as I'm going from DBF to MySQL, not MySQL to MySQL.

    Can someone advise on how I would do this within C#? I already have an OleDB Connection setup as such;

     public void runDbfCmd()
        {
            string constr = ConfigurationManager.ConnectionStrings["dbfString"].ConnectionString;
    
            using (OleDbConnection dbfCon = new OleDbConnection(constr))
            {
                try
                {
                    dbfCon.Open();
                    OleDbCommand dbfCmd = new OleDbCommand("SELECT INTO STATEMENT HERE");
                    dbfCmd.ExecuteNonQuery();
                }
                catch (OleDbException ex)
                {
                    throw ex;
                }
                finally
                {
                    dbfCon.Close();
                }
            }
        }
    

    As you can see I'm stuck on how to build the command and whether or not this will work how I would like it to.

    • Moved by CoolDadTx Friday, October 2, 2015 1:15 PM Wrong forums
    Friday, October 2, 2015 8:11 AM

Answers

  • These forums are for MS products and technologies.  Questions related to working with third party tools like FoxPro and MySQL should be posted in their forums. Specifically for MySQL you should be using their .NET provider.
    • Marked as answer by DRD94 Wednesday, October 21, 2015 10:25 AM
    Friday, October 2, 2015 1:15 PM