SQL Execution Error Failed to Convert from dateTime to TimeSpan
-
I executed the following query using Visual Basic in the Table Adapter wizard.
SELECT less_time, less_day FROM tbl_lessons WHERE (teach_id = 100) AND (less_status = 1) AND (less_time = '1/1/1900 3:00:00 PM') AND (less_day = 2)
In visual basic I use @param1, @param2 and @param3 for the teach_id, less_time and less_day. When I ran the query in Visual Basic I get the following error, but when I run the identical query using the SQL Server Express I do not get the error. Has anyone seen this error before? Why does it happen? How do I fix it?Error Source: System.Data
Error Message: Failed to convert paramater value from a dateTime to a timeSpan. -
I executed the following query using Visual Basic in the Table Adapter wizard.
SELECT less_time, less_day FROM tbl_lessons WHERE (teach_id = 100) AND (less_status = 1) AND (less_time = '1/1/1900 3:00:00 PM') AND (less_day = 2)
In visual basic I use @param1, @param2 and @param3 for the teach_id, less_time and less_day. When I ran the query in Visual Basic I get the following error, but when I run the identical query using the SQL Server Express I do not get the error. Has anyone seen this error before? Why does it happen? How do I fix it?Error Source: System.Data
Error Message: Failed to convert paramater value from a dateTime to a timeSpan.Take a look at the parameters that you've generated in the wizard. You'll find that one of them is a TimeSpan; and the code is passing in a DateTime. That's what you need to sort out.
Deja View - the feeling that you've seen this post before.
-
Take a look at the parameters that you've generated in the wizard. You'll find that one of them is a TimeSpan; and the code is passing in a DateTime. That's what you need to sort out.
Deja View - the feeling that you've seen this post before.
I looked in the wizard and I can't find a place to select a dataType. One of my table columns is a UDT named time that I created from dateTime. I did not create an assembly. Also the dateTime datatype that I pass in is a dateTime that adds a timespan to change the startTime. Is it possible that the time dataType could cause this? I also increment startTime with timeSpan which is a dateTime dataType in VB.NET. Could this cause the problem?