How do I pass C# DateTime
values (FromCreateDate
and ToCreateDate
) to SQL Server 2005 in order to select from a view ?
The result set CreateDate
column must be between FromDateDate
and ToCreateDate
.
Just set the parameter type to SqlDbType.DateTime
e.g
SqlCommand cmd = new SqlCommand("Select * From dbo.MyView Where createDate = @FromDate", SqlCon);
cmd.Parameters.Add(new SqlParameter(@FromDate, SqlDbType.DateTime));
cmd.Parameters["@FromDate"].Value = fromDate;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With