Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Update Date

Author  Topic 

Harold H. Dessart
Starting Member

1 Post

Posted - 2006-09-07 : 11:04:23
I'm trying to Update a Date in my database, but keep getting a Syntax error, and I can't find the problem. Here's the code;

<%
sStatus = Replace(Request.Form("sStatus"),"'","''")
dChangeDate = Replace(Request.Form("dChangeDate"),"'","''")
nID = Replace(Request.Form("nID"),"'","''")

set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = "DRIVER={Microsoft Access Driver (*.mdb)};" & "DBQ=" & server.mappath("../database/COAKLEY_ACCESS97.mdb")
sSQL = "Update tblCoakleyNew Set sStatus = '" & sStatus & "', dChangeDate = #" & dChangeDate & "# " & "Where nID = " & nID & " "

oConn.Open
oConn.Execute(sSQL)
oConn.Close
Set oConn=Nothing%>


Harold

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-07 : 11:19:26
Try printing the content of sSQL!

BTW, why are you replacing single quote in dChangeDate with double quotes when the quotes are not valid in dates?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-09-07 : 11:22:22
That worked fine when I tried it.

Note that this is a SQL Server forum - you should try posting this at an ASP.NET and/or Access forum.
Go to Top of Page
   

- Advertisement -