I use EF model-first in my application and use stored procedures too.
My table has a LastStatus column name of datetime datatype and it's nullable.
When the user fills in a datetime value, it works correctly.
Here is my code :
(@StartAcceptDate IS NULL OR LastStatusDate >= @StartAcceptDate)
AND (@EndAcceptDate IS NULL OR LastStatusDate >= @EndAcceptDate)
But when user want to select all record release the date.
Many records have null value.
My question is here: how to pass null as a datetime from C# to SQL Server?
The best way is to set the defaults parameters value to NULL in your stored procedure and you don't have to explicitly pass NULL to your stored procedure.
If you still want to send
NULLfrom your C# code to your stored procedure, you can useDBNull.Value