Read Method (SqlShimDataReader)
|
|---|
'Declaration
Public Overrides Function Read() As Boolean |
|
|---|
public override bool Read() |
Return Value
true if there are more rows; otherwise, false.
The following example creates a
Devart.Data.ExactTarget.ExactTargetConnection, a
Devart.Data.ExactTarget.ExactTargetCommand, and a
SqlShimDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the
SqlShimDataReader, then the
Devart.Data.ExactTarget.ExactTargetConnection.
|
|---|
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT ID, Name FROM Email";
ExactTargetConnection exactTargetConnection = new ExactTargetConnection(myConnString);
ExactTargetCommand exactTargetCommand = new ExactTargetCommand(mySelectQuery,exactTargetConnection);
exactTargetConnection.Open();
ExactTargetDataReader exactTargetReader;
exactTargetReader = exactTargetCommand.ExecuteReader();
// Always call Read before accessing data.
while (exactTargetReader.Read()) {
Console.WriteLine(exactTargetReader.GetString(0) + ", " + exactTargetReader.GetString(1));
}
// always call Close when done reading.
exactTargetReader.Close();
// Close the connection when done with it.
exactTargetConnection.Close();
} |
|
|---|
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT ID, Name FROM Email"
Dim exactTargetConnection As New ExactTargetConnection(myConnString)
Dim exactTargetCommand As New ExactTargetCommand(mySelectQuery, exactTargetConnection)
exactTargetConnection.Open()
Dim exactTargetReader As ExactTargetDataReader
exactTargetReader = exactTargetCommand.ExecuteReader()
' Always call Read before accessing data.
While exactTargetReader.Read()
Console.WriteLine(exactTargetReader.GetString(0) + ", " _
+ exactTargetReader.GetString(1))
End While
' always call Close when done reading.
exactTargetReader.Close()
' Close the connection when done with it.
exactTargetConnection.Close()
End Sub |