Return Value
true if there are more rows; otherwise, false.
While the SalesforceDataReader is in use, the associated SalesforceConnection is busy serving it until you call Close.
public void ReadMyData(string myConnString) { string mySelectQuery = "SELECT ID, Name FROM Account"; SalesforceConnection salesforceConnection = new SalesforceConnection(myConnString); SalesforceCommand salesforceCommand = new SalesforceCommand(mySelectQuery,salesforceConnection); salesforceConnection.Open(); SalesforceDataReader salesforceReader; salesforceReader = salesforceCommand.ExecuteReader(); // Always call Read before accessing data. while (salesforceReader.Read()) { Console.WriteLine(salesforceReader.GetInt32(0) + ", " + salesforceReader.GetString(1)); } // always call Close when done reading. salesforceReader.Close(); // Close the connection when done with it. salesforceConnection.Close(); }
Public Sub ReadMyData(myConnString As String) Dim mySelectQuery As String = "SELECT ID, Name FROM Account" Dim salesforceConnection As New SalesforceConnection(myConnString) Dim salesforceCommand As New SalesforceCommand(mySelectQuery, salesforceConnection) salesforceConnection.Open() Dim salesforceReader As SalesforceDataReader salesforceReader = salesforceCommand.ExecuteReader() ' Always call Read before accessing data. While salesforceReader.Read() Console.WriteLine(salesforceReader.GetInt32(0).ToString() + ", " _ + salesforceReader.GetString(1)) End While ' always call Close when done reading. salesforceReader.Close() ' Close the connection when done with it. salesforceConnection.Close() End Sub
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