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 |