dotConnect for Snowflake Documentation
Devart.Data.Snowflake Namespace / SnowflakeCommand Class / ExecuteReader Method / ExecuteReader(CommandBehavior) Method
One of the System.Data.CommandBehavior values.
Example

On this page
    ExecuteReader(CommandBehavior) Method
    On this page
    Sends the CommandText to the Connection, and builds a SnowflakeDataReader using one of the System.Data.CommandBehavior values.
    Syntax
    'Declaration
     
    Public Overloads Shadows Function ExecuteReader( _
       ByVal behavior As CommandBehavior _
    ) As SnowflakeDataReader
    public new SnowflakeDataReader ExecuteReader( 
       CommandBehavior behavior
    )

    Parameters

    behavior
    One of the System.Data.CommandBehavior values.

    Return Value

    Example
    The following example creates a SnowflakeCommand, 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 CreateSnowflakeDataReader(string mySelectQuery,string snowflakeConnectionString)
    {
      SnowflakeConnection snowflakeConnection = new SnowflakeConnection(snowflakeConnectionString);
      SnowflakeCommand snowflakeCommand = new SnowflakeCommand(mySelectQuery, snowflakeConnection);
      snowflakeCommand.Connection.Open();
      SnowflakeDataReader snowflakeReader = snowflakeCommand.ExecuteReader(CommandBehavior.CloseConnection);
      while(snowflakeReader.Read())
      {
        Console.WriteLine(snowflakeReader.GetString(0));
      }
      snowflakeReader.Close();
    }
    Public Sub CreateSnowflakeDataReader(mySelectQuery As String, _
    snowflakeConnectionString As String)
      Dim snowflakeConnection As New SnowflakeConnection(snowflakeConnectionString)
      Dim snowflakeCommand As New SnowflakeCommand(mySelectQuery, snowflakeConnection)
      snowflakeCommand.Connection.Open()
      Dim snowflakeReader As SnowflakeDataReader = snowflakeCommand.ExecuteReader(CommandBehavior.CloseConnection)
      While snowflakeReader.Read()
        Console.WriteLine(snowflakeReader.GetString(0))
      End While
      snowflakeReader.Close()
    End Sub
    See Also