C # passing DateTime to SQL Server stored procedure as DateTime parameter

I am passing {4/1/2017 12:00:00 AM}

from my C # code to SQL Server as a parameter to a stored procedure. And in a stored procedure, I want to convert this to a format MMddyyyy

for processing data. I tried many suggestions from google but nothing works for me.

Throwing this error:

Converting varchar datatype to datetime datatype resulted in out of range value

+3


source to share


1 answer


Try to convert the keyword in SQL, but you need to pass some parameter value (101,107) to convert.



+1


source







All Articles