Skip to content

NULL values

sdrapkin edited this page Feb 13, 2017 · 4 revisions

NULL T-SQL values are automatically converted into null .NET reference values and Nullable<T> struct values.

NULL parameter values can be specified by explicitly typing anonymous-object properties as type-null or Nullable<T>:

var result = await db.QueryAsync("UPDATE [SomeTable] SET [IntValue] = @Val WHERE [Id] = @Id",
	new
	{
		@Id = new Guid("cf9fad7a-9775-28b9-7693-11e6ea3b1484"),
		@Val = default(int) // setting [IntValue] to NULL
	});

Clone this wiki locally