user2077340
user2077340

Reputation: 161

C# Snowflake command

What is the syntax for these two C# Snowflake commands. Or where can i find it

using (var sfConn = new SnowflakeDbConnection())
{
    sfConn.ConnectionString = sConnectionString;
    sfConn.Open();
    var cmd = sfConn.CreateCommand();

    cmd.CommandText = "select top 100 * from RDW_SF.DM_LOAN.DIM_STD_MTHLY_DTM ;";
    SnowflakeDbCommand sfcmd = new SnowflakeDbCommand(sfConn.ConnectionString);
    SnowflakeDbCommandBuilder sf = new SnowflakeDbCommandBuilder(,)
    //  cmd.CommandText       = "select top 100 * from  RDW_SF.DM_LOAN.DIM_ACCT_CNTC;";
    // DWLoad_Load_DM_LOAN_DIM_STD_MTHLY_DTM)
    var reader = cmd.ExecuteReader();
    Console.WriteLine("Retrieving rows from the Query");
    SnowflakeDbDataAdapter mySnowflakeDbDataAdapter = new SnowflakeDbDataAdapter(csfcmd);
    DataSet myDataSet = new DataSet();
    mySnowflakeDbDataAdapter.Fill(myDataSet, "RECS");
    sfConn.Close();
    DataTable myDataTable = myDataSet.Tables["RECS"];
    nCols = myDataTable.Columns.Count;
}

Upvotes: 1

Views: 2820

Answers (1)

user13472370
user13472370

Reputation:

If you're looking for code examples, the snowflake-connector-net repository carries test-cases that exercise its features.

The Snowflake connector for .NET implements the standard and familiar .NET System.Data interfaces so any example online that uses them (across database types) can be adapted for use with Snowflake with simple SQL-syntax changes (to conform to Snowflake's SQL).

If you're looking for examples on how to perform a connection, you can find an example connection string here.

Upvotes: 2

Related Questions