ExecuteReader(CommandBehavior) Method
The following example creates a
ZohoDeskCommand, then executes it by passing a string that is SQL SELECT statement, and a string to use to connect to the data source. The
System.Data.CommandBehavior is then set to CloseConnection.
|
|---|
public void CreateZohoDeskDataReader(string mySelectQuery,string zohoDeskConnectionString)
{
ZohoDeskConnection zohoDeskConnection = new ZohoDeskConnection(zohoDeskConnectionString);
ZohoDeskCommand zohoDeskCommand = new ZohoDeskCommand(mySelectQuery, zohoDeskConnection);
zohoDeskCommand.Connection.Open();
ZohoDeskDataReader zohoDeskReader = zohoDeskCommand.ExecuteReader(CommandBehavior.CloseConnection);
while(zohoDeskReader.Read())
{
Console.WriteLine(zohoDeskReader.GetString(0));
}
zohoDeskReader.Close();
} |
|
|---|
Public Sub CreateZohoDeskDataReader(mySelectQuery As String, _
zohoDeskConnectionString As String)
Dim zohoDeskConnection As New ZohoDeskConnection(zohoDeskConnectionString)
Dim zohoDeskCommand As New ZohoDeskCommand(mySelectQuery, zohoDeskConnection)
zohoDeskCommand.Connection.Open()
Dim zohoDeskReader As ZohoDeskDataReader = zohoDeskCommand.ExecuteReader(CommandBehavior.CloseConnection)
While zohoDeskReader.Read()
Console.WriteLine(zohoDeskReader.GetString(0))
End While
zohoDeskReader.Close()
End Sub |