Forums
This topic is locked
Update Statement Help
Posted 12 Apr 2007 19:01:25
1
has voted
12 Apr 2007 19:01:25 Anthony Saloro posted:
The setup is this:Page 1: User enters a phone number of customer
Page 2: Returns the record that matches the criteria (phone number), and writes the values into a rs for editing
Page 3: Updates the database with the edited values.
Page 1 and 2 work fine, but for the life of me I can't figure out what I'm doing wrong on page 3. I keep getting the "syntax error in UPDATE statement"
Any help would be great.
<pre id=code><font face=courier size=2 id=code>
set conn=Server.CreateObject("ADODB.Connection"
conn.provider="Microsoft.Jet.OLEDB.4.0"
conn.open(server.mappath("Leads List.mdb")
Buyer1Phone=Request.Form("Buyer1Phone"
if Request.form("action"="Save" then
sql="UPDATE MASTER SET "
sql=sql & "Buyer1FName='" & Request.Form("Buyer1FName" & "',"
sql=sql & "Buyer1LName='" & Request.Form("Buyer1LName" & "',"
sql=sql & "Buyer2FName='" & Request.Form("Buyer2FName" & "',"
sql=sql & "Buyer2LName='" & Request.Form("Buyer2LName" & "',"
sql=sql & "PAddress='" & Request.Form("Paddress" & "',"
sql=sql & "PCity='" & Request.Form("PCIty" & "',"
sql=sql & "PZip='" & Request.Form("PZip" & "',"
sql=sql & "LoanAmount='" & Request.Form("LoanAmount" & "',"
sql=sql & "LoanType='" & Request.Form("LoanType" & "',"
sql=sql & "TypeFinancing='" & Request.Form("TypeFinancing" & "',"
sql=sql & "TDRate='" & Request.Form("TDRate" & "',"
sql=sql & "CurrentLTV='" & Request.Form("CurrentLTV" & "',"
sql=sql & "OriginalLTV='" & Request.Form("OriginalLTV" & "',"
sql=sql & "WHERE MASTER.[Buyer1Phone]=" & Buyer1Phone & "'"
conn.Execute sql
end if
conn.close
</font id=code></pre id=code>
Replies
Replied 13 Apr 2007 01:54:48
13 Apr 2007 01:54:48 Alan C replied:
Hi
sorry I have no asp, only php but if you are really stuck try a print (echo in php) that will show you the whole UPDATE query, then copy that and paste it into the sql page of phpmyadmin - from there you can execute it directly and see the result that comes back from mysql.
Then you can tweak the query and see just what is wrong
Hope that helps a little
sorry I have no asp, only php but if you are really stuck try a print (echo in php) that will show you the whole UPDATE query, then copy that and paste it into the sql page of phpmyadmin - from there you can execute it directly and see the result that comes back from mysql.
Then you can tweak the query and see just what is wrong
Hope that helps a little