Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

char data type to smalldatetime data

Status
Not open for further replies.

stevenr

Technical User
Feb 21, 2001
89
0
0
GB

I'm getting the error below:

The conversion of char data type to smalldatetime data type resulted in an out-of-range smalldatetime value. The statement has been terminated.

I have an asp.net page and an sql2000 dB with the updated field set as smalldatetime, when I save the web page, i want the updated field to have todays date.

How do i do this?
 
Steve,

I have found the easiest way to do this is to set the default value of your timestamp field to getdate(). This will insert the current date and time when the record is inserted. It's easier than dealing with date string formatting.

Keith
 
it works ok when i save a new record, but when i try to update i get the error.
why??
 
It's probably because you're updating the value with an out of range datetime value. For instance, if your default format in your database is YYYY/MM/DD and you're updating the date in the format MM/DD/YYYY, you'll receive an out of range error.

HTH,
Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top