Date/Time & Sql conversion issues

  • Thread starter Thread starter katmagic
  • Start date Start date
K

katmagic

I am having a heck of a time figuring out how to format a datetime value to
what sql wants. I have even copied the exception error and created a value
of Dim myDate as datetime="#1/1/1753 12:01:00 AM#" I've tried it with both
the # and without, I have tried using a string value and a datetime value.
I continue to get the error SqlDateTime overflow. Must be between 1/1/1753
12:00:00 AM and 12/31/9999 11:59:59 PM."

Do I have to make the value in my stored procedure a varchar and also the
field in the table a varchar? Is there no way to make a datetime field in
vb work with sql?

thank you for your help.
 
With SQL Server, use the DateTime in the SQL objects. You should also be
able to use a .NET DateTime, although you might have to use .ToString() to
feed to the parameter correctly.

I have not had problems with strings, as far as I remember, but the ## have
to go. That is an "Access-ism".

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
 
Back
Top