locked
Cannot insert dataset into mysql table RRS feed

  • Question

  • I am working on a vb.net application in Visual Studio 2008

    I have two mysql tables with the same field names, one table is located on a server and the other table is located on a client pc.

    I have to transfer all the records in the mysql table found on the server to a mysql table located on the client pc.

    I have been able to capture all the records in the mysql table found on the server but I am not able to insert it into the mysql table on the client pc.

    I have used the following code:

    myconnection.ConnectionString = (sconnect)

    sql =

    "select * from sample"

    mycommand =

    New MySqlCommand(sql, myconnection)

    myconnection.Open()

    myadapter.SelectCommand = mycommand

    myadapter.Fill(mydataset)

    myconnection.Close()

    myconnection1.ConnectionString = (sconnect1)

    myconnection1.Open()

     

    If (mydataset.Tables.Count <> 0) Then

    sql1 =

    "INSERT INTO sample1 VALUES('" & mydataset.ToString & "')"

    mycommand1 =

    New MySqlCommand(sql1, myconnection1)

    mycommand1.ExecuteNonQuery()

    myconnection1.close

     

     

    Can anyone help me please, thanks in advance.  

     

    • Moved by Allen Chen - MSFT Monday, July 5, 2010 6:53 AM not a WCF issue (From:Windows Communication Foundation)
    Friday, July 2, 2010 11:44 AM

Answers

  • Try the .Net forum on  http://forums.mysql.com/

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
    Visual C++ MVP
    Thursday, July 8, 2010 4:21 AM