PDA

View Full Version : help needed with SQL "UPDATE" with new OLEDB conn


runfirst
09-12-2004, 04:09 AM
I figured my problem. I didn't realize that the UPDATE syntax was different than the ODBC drivers...


I was browsing back through the user forum... and found that the syntax for the new OLDEB uses (aparently):

UPDATE table SET table.columnY WHERE table.column.X = ...

and I was using

UPDATE table SET columnY WHERE columnX = ...

seems odd that this fixed my problem? [}:)]

Runfirst.[8D]

runfirst
09-12-2004, 08:09 AM
I have recently switched to the new OLEDB Jet 4.0 connection string, and all my SELECT querries are working fine. However, I'm reworking some "UPDATE" commands and things aren't working. I keep getting the error:

SQL syntax error in UPDATE statment. source=Microsoft Jet Engine
(or something very close to that)

Here is my code snippet: I'm using the connection object directly to execute my SQL statment. If someone knows why this isn't working, I'd surely appreciate an email or reply. Again, the actual connection is working fine... just the UPDATE isn't working...
__________________________________________________ __________
dim szConn
dim conn
szConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=xxxxxxxx(deleted for privacy);User ID=Admin;"
set conn = Server.CreateObject("ADODB.Connection")
conn.Open szConn

dim szSQL
szSQL = "UPDATE Admin SET Password = '" & Request.Form("Password2") & "' WHERE Username = 'yousoldit'"
on error resume next

conn.Execute szSQL, adAffectCurrent

if err<>0 then
Response.Write(err.Description & " " & err.Source )
else
Response.Write("GOOD! YOU DID IT!!")
end if
__________________________________________________ ________________