The following example creates a
ExactTargetCommand, 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 CreateExactTargetDataReader(string mySelectQuery,string exactTargetConnectionString)
{
ExactTargetConnection exactTargetConnection = new ExactTargetConnection(exactTargetConnectionString);
ExactTargetCommand exactTargetCommand = new ExactTargetCommand(mySelectQuery, exactTargetConnection);
exactTargetCommand.Connection.Open();
ExactTargetDataReader exactTargetReader = exactTargetCommand.ExecuteReader();
try
{
while(exactTargetReader.Read())
{
Console.WriteLine(exactTargetReader.GetString(0));
}
}
finally
{
exactTargetReader.Close();
exactTargetConnection.Close();
}
}
Public Sub CreateExactTargetDataReader(mySelectQuery As String, _
exactTargetConnectionString As String)
Dim exactTargetConnection As New ExactTargetConnection(exactTargetConnectionString)
Dim exactTargetCommand As New ExactTargetCommand(mySelectQuery, exactTargetConnection)
exactTargetCommand.Connection.Open()
Dim exactTargetReader As ExactTargetDataReader = exactTargetCommand.ExecuteReader()
Try
While exactTargetReader.Read()
Console.WriteLine(exactTargetReader.GetString(0))
End While
Finally
exactTargetReader.Close()
exactTargetConnection.Close()
End Try
End Sub