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.Magento.MagentoConnection, a
Devart.Data.Magento.MagentoCommand, 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.Magento.MagentoConnection.
|
|---|
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT customer_id, lastname FROM Customers";
MagentoConnection magentoConnection = new MagentoConnection(myConnString);
MagentoCommand magentoCommand = new MagentoCommand(mySelectQuery,magentoConnection);
magentoConnection.Open();
MagentoDataReader magentoReader;
magentoReader = magentoCommand.ExecuteReader();
// Always call Read before accessing data.
while (magentoReader.Read()) {
Console.WriteLine(magentoReader.GetString(0) + ", " + magentoReader.GetString(1));
}
// always call Close when done reading.
magentoReader.Close();
// Close the connection when done with it.
magentoConnection.Close();
} |
|
|---|
Public Sub ReadMyData(myConnString As String)
Dim mySelectQuery As String = "SELECT customer_id, lastname FROM Customers"
Dim magentoConnection As New MagentoConnection(myConnString)
Dim magentoCommand As New MagentoCommand(mySelectQuery, magentoConnection)
magentoConnection.Open()
Dim magentoReader As MagentoDataReader
magentoReader = magentoCommand.ExecuteReader()
' Always call Read before accessing data.
While magentoReader.Read()
Console.WriteLine(magentoReader.GetString(0) + ", " _
+ magentoReader.GetString(1))
End While
' always call Close when done reading.
magentoReader.Close()
' Close the connection when done with it.
magentoConnection.Close()
End Sub |