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
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