SQL UPDATE with a Date Data Type

G

Guest

Hi folks,

I am doing an UPDATE to a table that has a field for a DATE data type. I am
using MS Access.

The UPDATE works fine but when I try to place the DATE field in the mix it
blows up.

The table name is rfi.

Here's a code snippet...
Dim dtNow As DateTime = DateTime.Now
UPDATE [rfi] SET [dateresolved]=dtNow WHERE ([rfi].[id] = @id)

It does not like dtNow, so I tried using dtNow.ToString ( ) which it also
did not like.
Next I changed the data-type for the dateresolved field from DATE to STRING
and tried to put in dtNow.ToString ( ) which it still did not like.

Finally, I hard coded a string in as "8/15/2006" which it accepted both as a
DATE type and as a STRING type.

Any ideas on what I may be missing would be appreciated.

- Glenn
 
G

Guest

glenn,

Were you able to debug to check what value is exactly passed. I guess, this
coould be because of the format of the date. Probably it is trying to pass
'dd/mm/yyyy' whereas your sql server expects 'mm/dd/yyyy' format.

Regards,
Augustin
 

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

Forum statistics

Threads
473,771
Messages
2,569,587
Members
45,097
Latest member
RayE496148
Top