ExecuteReader(CommandBehavior) Method
The following example creates a
BigQueryCommand, 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 CreateBigQueryDataReader(string mySelectQuery,string bigQueryConnectionString)
{
BigQueryConnection bigQueryConnection = new BigQueryConnection(bigQueryConnectionString);
BigQueryCommand bigQueryCommand = new BigQueryCommand(mySelectQuery, bigQueryConnection);
bigQueryCommand.Connection.Open();
BigQueryDataReader bigQueryReader = bigQueryCommand.ExecuteReader(CommandBehavior.CloseConnection);
while(bigQueryReader.Read())
{
Console.WriteLine(bigQueryReader.GetString(0));
}
bigQueryReader.Close();
} |
|
|---|
Public Sub CreateBigQueryDataReader(mySelectQuery As String, _
bigQueryConnectionString As String)
Dim bigQueryConnection As New BigQueryConnection(bigQueryConnectionString)
Dim bigQueryCommand As New BigQueryCommand(mySelectQuery, bigQueryConnection)
bigQueryCommand.Connection.Open()
Dim bigQueryReader As BigQueryDataReader = bigQueryCommand.ExecuteReader(CommandBehavior.CloseConnection)
While bigQueryReader.Read()
Console.WriteLine(bigQueryReader.GetString(0))
End While
bigQueryReader.Close()
End Sub |