Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,21 @@ using (IDbConnection conn = new SnowflakeDbConnection())
}
```

Writing to `VARIANT` column with bind variable
----------------------------------------------
You can use bind variables together with `VARIANT` datatype column. For example, to insert data:
```cs
cmd.CommandText = "insert into table (id, data) select :id, parse_json(:data)"
```
then reference the `SFDataType` for the named parameter, `p2` in this example:
```cs
p2.SFDataType = SFDataType.TEXT
```
As an alternative, you can use an approach like:
```cs
var p2 = new SnowflakeDbParameter("data", SFDataType.TEXT) { Value = jsonStr };
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only thing binding with named parameters is not supported in multi statement queries.
Can you please make a not on this @sfc-gh-dszmolka and we will merge this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close the Connection
--------------------

Expand Down