Home > Uncategorized > Assigning a null value to some ASP.Net parameterized queries

Assigning a null value to some ASP.Net parameterized queries

In some situations an error will be thrown when trying to assign “null” to a parameter for a query.  In this situation, assign “DBNull.Value” to the parameter.

Example:

thisCommand.Parameters.Add(“@datLastCalExpr”, System.Data.SqlDbType.DateTime).Value = DBNull.Value;

Print Friendly, PDF & Email
Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.