dotConnect for Snowflake Documentation
Devart.Data.Snowflake Namespace / SnowflakeConnection Class / CreateCommand Method
Example

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

    Return Value

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