Updating Date using SQL

andy1210

Registered User.
Local time
Today, 06:04
Joined
Mar 14, 2006
Messages
15
I have a table which contains dates in the format (mm/dd/yyyy) as well as other information, I am trying to get an ASP website to update the date with values chosen by the user. The problem is that when using the UPDATE command it returns an error, saying the syntax is wrong. Here is my SQL statement and the error message it produces, if anyone has got any ideas, please let me know -:

"UPDATE Users SET Name = '"& UpName &"', DOB = #"& AddMonth &"/"& AddDay &"/"& AddYear &"# WHERE ID = "& ID &" "

The error message I get in return is -:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error in date in query expression '#//#'.


Thanks in Advance
Andy
 
Problem Solved

Have solved the problem with a little bit of advice, all I did was set the dates chosen by the user as one variable, then in the sql statement i set the date to equal this one variable.

DateString= Upday+"/"+UpMonth+"/"+UpYear

Sql Statement Reads -:

.....DOB = #"& DateString &"# WHERE ID = "& ID &"

Cheers

Andy
 

Users who are viewing this thread

Back
Top Bottom