Problem sending date to SQL date time field

R

Robin

In an ASP.Net page when trying to send a VB.net datetime field into a SQL
Server stored procedure parameter of type datetime the following error
occurs.

SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999
11:59:59 PM

How can the data be converted? What format does the field need to be in?
 
J

Jeremy Samuel

DateTime objects are ByValue - so they are initalized to a value of
DateTime.MinValue. If your DateTime object is still set to the initial value
, then 1/1/1 will be sent to SQL. This is immediately rejected. You have to
pass null (Nothing) as the value of the parameter or set a default -
depending on your specific needs. THis may be what is causing the error.
 
G

Guest

The data type is Date. Just make sure the value of the date is not #12:00:00# SQL Server sees this a Jan 1, 0001 and that is out of range.

hope this helps,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top