BigQueryCommandBuilder Class
Automatically generates single-table commands used to reconcile changes made to a
System.Data.DataSet with the Google BigQuery.
The following example uses
BigQueryCommand, along with
BigQueryDataAdapter and
BigQueryConnection, to select rows from Google BigQuery. The example is passed an initialized
System.Data.DataSet, a connection string, a query string that is SQL SELECT statement, and a string that is the name of the Google BigQuery table. The example then creates a
BigQueryCommandBuilder.
|
|---|
public DataSet SelectBigQuerySrvRows(DataSet myDataSet,string bigQueryConnection,string mySelectQuery,string myTableName)
{
BigQueryConnection myConn = new BigQueryConnection(bigQueryConnection);
BigQueryDataAdapter myDataAdapter = new BigQueryDataAdapter();
myDataAdapter.SelectCommand = new BigQueryCommand(mySelectQuery, myConn);
BigQueryCommandBuilder bigQueryCommandBuilder = new BigQueryCommandBuilder(myDataAdapter);
myConn.Open();
DataSet myDataSet = new DataSet();
myDataAdapter.Fill(myDataSet, "Departments");
//code to modify data in dataset here
//Without the BigQueryCommandBuilder this line would fail
myDataAdapter.Update(myDataSet, "Departments");
myConn.Close();
return myDataSet;
} |
|
|---|
Public Function SelectBigQuerySrvRows(myDataSet As DataSet, bigQueryConnection As String, mySelectQuery As String, myTableName As String) As DataSet
Dim myConn As New BigQueryConnection(bigQueryConnection)
Dim myDataAdapter As New BigQueryDataAdapter()
myDataAdapter.SelectCommand = New BigQueryCommand(mySelectQuery, myConn)
Dim bigQueryCommandBuilder As BigQueryCommandBuilder = New BigQueryCommandBuilder(myDataAdapter)
myConn.Open()
Dim myDataSet As DataSet = New DataSet
myDataAdapter.Fill(myDataSet, "Departments")
' Code to modify data in DataSet here
' Without the BigQueryCommandBuilder this line would fail.
myDataAdapter.Update(myDataSet, "Departments")
myConn.Close()
SelectBigQuerySrvRows = myDataSet
End Function |