dotConnect for Google BigQuery Documentation
Devart.Data.BigQuery Namespace / BigQueryConnection Class / CreateCommand Method
Example

On this page
    CreateCommand Method (BigQueryConnection)
    On this page
    Creates and returns a BigQueryCommand object associated with the BigQueryConnection.
    Creates and returns a BigQueryCommand object associated with the BigQueryConnection.
    Syntax
    'Declaration
     
    Public Shadows Function CreateCommand() As BigQueryCommand
    public new BigQueryCommand CreateCommand()

    Return Value

    A BigQueryCommand object.
    Remarks
    You can use this method as an alternative to common BigQueryCommand constructors.
    Example
    In this sample BigQueryCommand object is created. It is automatically associated with BigQueryConnection that created it.
    public void CreateBigQueryCommand(string myConnString)
    {
      BigQueryConnection bigQueryConnection = new BigQueryConnection(myConnString);
      BigQueryCommand bigQueryCommand = bigQueryConnection.CreateCommand();
      bigQueryCommand.CommandText = "INSERT INTO your_project.your_dataset.employees (first_name, last_name) VALUES ('John', 'Smith')";
      bigQueryConnection.Open();
      try
      {
        bigQueryCommand.ExecuteNonQuery();
      }
      finally
      {
        bigQueryConnection.Close();
      }
    }
    Public Sub CreateBigQueryCommand(ByVal myConnString As String)
      Dim bigQueryConnection As New BigQueryConnection(myConnString)
      Dim bigQueryCommand As BigQueryCommand = bigQueryConnection.CreateCommand()
      bigQueryCommand.CommandText = "INSERT INTO your_project.your_dataset.employees (first_name, last_name) VALUES ('John', 'Smith')"
      bigQueryConnection.Open()
      Try
        bigQueryCommand.ExecuteNonQuery()
      Finally
        bigQueryConnection.Close()
      End Try
    End Sub
    See Also