I am placing DateTime into SQL using an ASP.NET form. The date should be formatted dd/mm/yyyy hh/mm/ss.
I am getting the error below. Is there any way to convert the format of the DateTime function from the ASP.NET end?
Thanks
mes
"The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value"
DateTimes aren't "formatted". It sounds like you are giving it a string, that you think looks like a date. Give the database a real datetime (Or specify the sqlparameter as being of datetime type), and your problem should go away. If that string format isn't valid for your culture, well... You'll have to fix that separately, or manually convert your "DateTime in a string" to a format that your SQL Server wants.
No comments:
Post a Comment