|
| |
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
Update DB with PayPal data - 8/8/2006 18:15:47
I can successfully receive information back from PayPal and get it to display on a confirmation page. I am getting the following fields back: Credit Card Infor: firstName, lastName My database id: itemNumber Payment amount: mcGross What I want to do is put the Credit Card Information into my registration record. I want this to automatically happen; I do NOT want to have to have the person select a button to get this to happen. The page is created entirely in ASP Script, so I would like to update the database using ASP Script. Here is what I've tried to do. quote:
... Response.Write("<p><h3>Your order has been received.</h3></p>") Response.Write("<b>Details</b><br>") Response.Write("<li>Credit Card Owner: " & firstName & " " & lastName & "</li>") Response.Write("<li>Description: " & itemName & "</li>") Response.Write("<li>Registration No: " & itemNumber & "</li>") Response.Write("<li>Amount: " & mcCurrency & " " & mcGross & "</li>") Response.Write("<hr>") <!--#include file="_fpclass/fpdblib.inc"--> <!--#include file="_fpclass/fpdbrgn1.inc"--> Dim Connect set connect = server.createObject("ADOB.Connection") connect.open "Registration" fp_sQry="SELECT * FROM Registration WHERE (Registratio_ID = ::itemNumber::)" Registration("R_Credit_Card_Payor") = "lastName" Registration.Update ... I've looked in a couple of books on ASP but not sure which way to go, since for the rest of the pages I'm using FrontPage to generate the DB information. Can anyone help. Trudy
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/8/2006 19:33:13
Post the full page code and I may be able to take a stab at it.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 11:56:49
quote:
ORIGINAL: TrudyD1474 What I want to do is put the Credit Card Information into my registration record. I want this to automatically happen; I do NOT want to have to have the person select a button to get this to happen. Can you clarify a bit? When you say put the Credit Card Information into the registration record, are you talking about updating a record that is already there or adding a new record? If you are going to update or even add, I would assume you would need the unique ID for the user so as to be able to associate the data. Is that info available on the page?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 12:48:49
Here's my error: quote:
Microsoft OLE DB Provider for ODBC Drivers error '80004005' [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified /registration/payment_confirmation.asp, line 84 Here's the coding in global.asa quote:
'--Project Data Connection Application("Registration_ConnectionString") = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/Registratio.mdb" FrontPage_UrlVars(0) = "Registration_ConnectionString" Application("Registration_ConnectionTimeout") = 15 Application("Registration_CommandTimeout") = 30 Application("Registration_CursorLocation") = 3 Application("Registration_RuntimeUserName") = "" Application("Registration_RuntimePassword") = "" '-- Application("FrontPage_UrlVars") = FrontPage_UrlVars '==FrontPage Generated - endspan== And here is what I changed the coding to based on Spooky's input: quote:
sSQL = "INSERT INTO Registration (R_Credit_Card_Payor) VALUES ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber) Set Registration = Server.CreateObject("ADODB.Connection") Registration.Open DSN=Registration Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing Trudy
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 14:25:30
Spooky, I don't seem to see balanced " quotes in the above statement you gave me. Is the punctuation correct? Trudy
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 15:17:20
Spooky, On the line Registration.Execute (sSQL),,129 what is the 129 and why is it there? Trudy
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 17:16:36
Well, now I'm getting a different message: Microsoft JET Database Engine error '80040e14' Missing semicolon (;) at end of SQL statement. /registration/payment_confirmation.asp, line 85 Here is my code now: quote:
sSQL = "INSERT INTO Registration (R_Credit_Card_Payor) VALUES ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber) Set Registration = Server.CreateObject("ADODB.Connection") Registration.Open Application("Registration_ConnectionString") Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing The red line is line 85. Now what do I do?
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:09:39
I made the change, and that is very logical. However, I'm still getting the following error: Microsoft JET Database Engine error '80040e14' Missing semicolon (;) at end of SQL statement. /registration/payment_confirmation.asp, line 85 mycode: quote:
sSQL = "UPDATE Registration (R_Credit_Card_Payor) VALUES ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber) Set Registration = Server.CreateObject("ADODB.Connection") Registration.Open Application("Registration_ConnectionString") Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:22:43
You aren't putting the SQL on two lines like it shows in your post are you?
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:33:56
no........ all one line....... Trudy
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:46:13
The semicolon error is a telltale sign of using a WHERE clause with an INSERT. If you are sure you replaced the INSERT SQL with the UPDATE SQL, I can only suggest trying to include the semicolon, like this: sSQL = "UPDATE Registration (R_Credit_Card_Payor) VALUES ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber) &";"
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:50:54
Already tried that........... here is the line quote:
sSQL = "UPDATE Registration (R_Credit_Card_Payor) VALUES ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber)
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:55:20
tried it again.... here is the message: Microsoft JET Database Engine error '80040e14' Syntax error in UPDATE statement. /registration/payment_confirmation.asp, line 85 so there does seem to be a problem with the UPDATE
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 19:56:07
This is the correct SQL, that I posted in post #12: sSQL = "UPDATE Registration SET R_Credit_Card_Payor = '"&lastName&"' WHERE Registratio_ID ="& cLng(itemNumber) see the difference? UPDATE statements have a different syntax that INSERT statements. UPDATE tableName SET (dbfield=formfield) INSERT INTO tableName (dbfield) VALUES (formfield)
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 20:11:54
sSQL = "UPDATE Registration SET (R_Credit_Card_Payor) = ('"&lastName&"') WHERE Registratio_ID ="& cLng(itemNumber) Do we still use WHERE? I think I still have a problem with format.
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 20:17:07
Yes. The WHERE specifies which record to update. You added () around the db field and the variable. Did you try it exactly as I posted, without the ()? sSQL = "UPDATE Registration SET R_Credit_Card_Payor = '"&lastName&"' WHERE Registratio_ID ="& cLng(itemNumber)
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 20:30:48
OK, here is the coding.....but I think I have quotes in the wrong place....... sSQL = "UPDATE Registration SET (Registration_id=" & itemNumber ") INSERT INTO Registration (R_Credit_Car_Payor) VALUES (" & lastName ")" Set Registration = Server.CreateObject("ADODB.Connection") Registration.Open Application("Registration_ConnectionString") Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing my message is this: Expected end of statement /registration/payment_confirmation.asp, line 81 sSQL = "UPDATE Registration SET (Registration_id=" & itemNumber ") INSERT INTO Registration (R_Credit_Car_Payor) VALUES (" & lastName ")" ----------------------------------------------------------------^ Trudy
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 20:35:54
Duane, I copied and pasted your line...... here is the message......the underline goes as far as SET Expected end of statement /registration/payment_confirmation.asp, line 81 sSQL = "UPDATE Registration SET R_Credit_Card_Payor = '"&lastName&"' WHERE Registratio_ID ="& cLng(itemNumber) Set Registration = Server.CreateObject("ADODB.Connection") ---------------------------------------------------------------------------------------------------------------^
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 20:40:43
Object required: '' /registration/payment_confirmation.asp, line 82 recopied and repasted....... quote:
sSQL = "UPDATE Registration SET R_Credit_Card_Payor = '"&lastName&"' WHERE Registratio_ID ="& cLng(itemNumber) Registration.Open Application("Registration_ConnectionString") Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 21:02:39
What is on line 82? Might want to post the whole code here. Do that by putting the code between these tags: [ code ] and [ /code ] Except remove the spaces before and after the brackets.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
|
|
TrudyD1474
Posts: 89 Joined: 4/26/2006 From: Trudy Doolittle Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 21:10:25
error message quote:
Object required: '' /registration/payment_confirmation.asp, line 82 code line 82 is in red....... quote:
<html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Payment Confirmation</title> </head> <body> <p><b><font size="4">Thank you for your payment.</font></b> </p> <p>Your transaction has been completed, and a receipt for your purchase has been emailed to you. You may log into your account at <a href="https://www.sandbox.paypal.com/us/">www.sandbox.paypal.com/us</a> to view details of this transaction. .</p> <p><img border="0" src="2_workers.gif" width="600" height="32"></p> <%@LANGUAGE="VBScript"%> <% Dim authToken, txToken Dim query Dim objHttp Dim sQuerystring Dim sParts, iParts, aParts Dim sResults, sKey, sValue Dim i, result Dim itemNumber, firstName, lastName, itemName, mcGross, mcCurrency authToken ="LObybRyuF1ioO7uufP7IhdZwV-bt1mblFLi7X21pr4GAQZYhKfQxZNVAh7y" txToken = Request.Querystring("tx") query = "cmd=_notify-synch&tx=" & txToken & "&at=" & authToken set objHttp = Server.CreateObject("Microsoft.XMLHTTP") ' set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP") objHttp.open "POST", "http://www.sandbox.paypal.com/cgi-bin/webscr", false objHttp.Send query sQuerystring = objHttp.responseText If Mid(sQuerystring,1,7) = "SUCCESS" Then sQuerystring = Mid(sQuerystring,9) sParts = Split(sQuerystring, vbLf) iParts = UBound(sParts) - 1 ReDim sResults(iParts, 1) For i = 0 To iParts aParts = Split(sParts(i), "=") sKey = aParts(0) sValue = aParts(1) sResults(i, 0) = sKey sResults(i, 1) = sValue Select Case sKey Case "item_number" itemNumber = sValue Case "first_name" firstName = sValue Case "last_name" lastName = sValue Case "item_name" itemName = sValue Case "mc_gross" mcGross = sValue Case "mc_currency" mcCurrency = sValue End Select Next Response.Write("<p><h3>Your order has been received.</h3></p>") Response.Write("<b>Details</b><br>") Response.Write("<li>Credit Card Owner: " & firstName & " " & lastName & "</li>") Response.Write("<li>Description: " & itemName & "</li>") Response.Write("<li>Registration No: " & itemNumber & "</li>") Response.Write("<li>Amount: " & mcCurrency & " " & mcGross & "</li>") Response.Write("<hr>") sSQL = "UPDATE Registration SET R_Credit_Card_Payor = '"&lastName&"' WHERE Registratio_ID ="& cLng(itemNumber) Registration.Open Application("Registration_ConnectionString") Registration.Execute(sSQL),,129 Registration.Close Set Registration = Nothing Else 'log for manual investigation Response.Write("ERROR") End If %> </body> </html>
|
|
|
|
BeTheBall
Posts: 6381 Joined: 6/21/2002 From: West Point Utah USA Status: offline
|
RE: Update DB with PayPal data - 8/9/2006 22:20:18
You removed this line: Set Registration = Server.CreateObject("ADODB.Connection") Put it back in right after or before the sSQL line.
_____________________________
Duane Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|