The following example creates a
MailChimpCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source.
|
|---|
public void CreateMailChimpDataReader(string mySelectQuery,string mailChimpConnectionString)
{
MailChimpConnection mailChimpConnection = new MailChimpConnection(mailChimpConnectionString);
MailChimpCommand mailChimpCommand = new MailChimpCommand(mySelectQuery, mailChimpConnection);
mailChimpCommand.Connection.Open();
MailChimpDataReader mailChimpReader = mailChimpCommand.ExecuteReader();
try
{
while(mailChimpReader.Read())
{
Console.WriteLine(mailChimpReader.GetString(0));
}
}
finally
{
mailChimpReader.Close();
mailChimpConnection.Close();
}
} |
|
|---|
Public Sub CreateMailChimpDataReader(mySelectQuery As String, _
mailChimpConnectionString As String)
Dim mailChimpConnection As New MailChimpConnection(mailChimpConnectionString)
Dim mailChimpCommand As New MailChimpCommand(mySelectQuery, mailChimpConnection)
mailChimpCommand.Connection.Open()
Dim mailChimpReader As MailChimpDataReader = mailChimpCommand.ExecuteReader()
Try
While mailChimpReader.Read()
Console.WriteLine(mailChimpReader.GetString(0))
End While
Finally
mailChimpReader.Close()
mailChimpConnection.Close()
End Try
End Sub |