MailChimpCommandBuilder Class
Automatically generates single-table commands used to reconcile changes made to a
System.Data.DataSet with the Mailchimp.
The following example uses
MailChimpCommand, along with
MailChimpDataAdapter and
MailChimpConnection, to select rows from Mailchimp. The example is passed an initialized
System.Data.DataSet, a connection string, a query string that is SQL SELECT statement, and a string that is the name of the Mailchimp table. The example then creates a
MailChimpCommandBuilder.
public DataSet SelectMailChimpSrvRows(DataSet myDataSet,string mailchimpConnection,string mySelectQuery,string myTableName)
{
MailChimpConnection myConn = new MailChimpConnection(mailchimpConnection);
MailChimpDataAdapter myDataAdapter = new MailChimpDataAdapter();
myDataAdapter.SelectCommand = new MailChimpCommand(mySelectQuery, myConn);
MailChimpCommandBuilder mailchimpCommandBuilder = new MailChimpCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the MailChimpCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
}
Public Function SelectMailChimpSrvRows(myDataSet As DataSet, mailchimpConnection As String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New MailChimpConnection(mailchimpConnection)
Dim myDataAdapter As New MailChimpDataAdapter()
myDataAdapter.SelectCommand = New MailChimpCommand(mySelectQuery, myConn)
Dim mailchimpCommandBuilder As MailChimpCommandBuilder = New MailChimpCommandBuilder(myDataAdapter)
myConn.Open()
Dim myDataSet As DataSet = New DataSet
myDataAdapter.Fill(myDataSet, "Departments")
' Code to modify data in DataSet here
' Without the MailChimpCommandBuilder this line would fail.
myDataAdapter.Update(myDataSet, "Departments")
myConn.Close()
SelectMailChimpSrvRows = myDataSet
End Function
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2