Dthmtlgod wrote:
I am using a short date format (mm/dd/yy).
Bad idea. You should use the less ambiguous ISO format (yyyymmdd for SQL
Server; yyyy-mm-dd for Access) when passing dates to your database
When I enter in a date
and run my update query, it is not accepting the data it puts in
12/30/1899
Here is the response.write of my SQL statement.
UPDATE Problems SET STATUS = 'Received', ComputerName = '', FupDate =
02/28/2005, Priority = 'Medium', IM_CHG = '', ProblemType = 'OTHER'
WHERE TicketNumber = 5
Does the date need #'s around it?
It depends on what database you are using, and what the datatype of your
column is (the format is irrelevant). If Access, if it's a date/time field
(which is what I suspect due to the 12/30/1899 result), then yes, #'s are
required. If it's a SQL Server datetime field, then quotes are required. of
course, if you use parameters, then you don't have to worry about delimiters
at all, as well as protecting yourself from sql injection. Here is how I
would run your update statement if my arm was twisted to make me create it
in vbscript instead of using a saved parameter query:
dim sSQL, cn, cmd, arParms
sSQL = "UPDATE Problems SET STATUS = ?, " & _
"ComputerName = ?, FupDate = ?, Priority = ?, " & _
" IM_CHG = ?, ProblemType = ? WHERE TicketNumber = ?"
arParms=array("Received", "", #2005-02-28#, "Medium", "", _
"OTHER", 5)
set cn=createobject("adodb.connection")
cn.open "<OLE DB connection string>"
set cmd=createobject("adodb.command")
cmd.commandtype=1
cmd.commandtext=sSQL
set cmd.activeconnection=cn
cmd.execute , arParms, 128
cn.close:set cn=nothing
HTH,
Bob Barrows
PS. Please don't make us guess what database you are using. Always include
this information.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.