List:MySQL and .NET« Previous MessageNext Message »
From:David Anderson Date:January 18 2006 11:15pm
Subject:How do I put data into a table?
View as plain text  
Hello All,

I am creating a dataset with one table called Members. I want to now
put this data into a table in a database table called Members. I use
a DataAdapter to do so.

When I try to run the code below, nothing happens to the database
table. What am I doing wrong?

Public Class OutData

    Sub New(ByVal ds As DataSet)

        Dim conn As New MySqlClient.MySqlConnection
        Dim connString As String = "Persist Security
        Info=False;database=WOSAdmin;server=xx;userid=xx;Password=xx"
        conn.ConnectionString = connString
        conn.Open()
        Dim da As New MySqlClient.MySqlDataAdapter("select * from Members", conn)
        Dim cB As New MySqlClient.MySqlCommandBuilder(da)
        da.InsertCommand = cB.GetInsertCommand
        da.DeleteCommand = cB.GetDeleteCommand
        da.UpdateCommand = cB.GetUpdateCommand

        Dim daDs As New System.Data.DataSet

        daDs.Merge(ds)  ' Have also tried daDs.copy(ds)

        da.Update(daDs, "Members")    'daDs actually contains the data
  

-- 
Best regards,
 David                          mailto:david@stripped


Thread
How do I put data into a table?David Anderson19 Jan
RE: How do I put data into a table?Lynn Eriksen19 Jan