Script To Write to Dbase HELP!!!
Hi,
I have a form that sends the info in the
completed boxes to a server. The server then
sends me a response message that is parsed into
table form per a subroutine. THAT ALL WORKS FINE.
Problem is with the sub I've tried to write to
add the same response msg info into a database.
Here's the code for both:
------------
'This function writes out the parsed return data in a table format
Sub WriteReturnData(strMsg)
DIM arrNames(9), arrValues(9)
arrNames(0)="Merchant Id"
arrNames(1)="Transaction Type"
arrNames(2)="Total Amount"
arrNames(3)="First Name"
arrNames(4)="Last Name"
arrNames(5)="Response Type"
arrNames(6)="Response Code"
arrNames(7)="Response Description"
arrNames(8)="Authorization Code"
arrNames(9)="Trace Number"
arrValues(0)=ParseString(strMsg,"pg_merchant_id=")
arrValues(1)=ParseString(strMsg,"pg_transaction_ty pe=")
arrValues(2)=ParseString(strMsg,"pg_total_amount=" )
arrValues(3)=ParseString(strMsg,"ecom_billto_posta l_name_first=")
arrValues(4)=ParseString(strMsg,"ecom_billto_posta l_name_last=")
arrValues(5)=ParseString(strMsg,"pg_response_type= ")
arrValues(6)=ParseString(strMsg,"pg_response_code= ")
arrValues(7)=ParseString(strMsg,"pg_response_descr iption=")
arrValues(8)=ParseString(strMsg,"pg_authorization_ code=")
arrValues(9)=ParseString(strMsg,"pg_trace_number=" )
Response.Write "<center><P><B>Response For Your Check Transaction</B></P>"
Response.Write "<Table border=0>"
FOR i=0 TO UBOUND(arrValues)
IF arrValues(i) > "" THEN
Response.Write "<tr>"
Response.Write "<td align=right>" & arrNames(i) & ": </td>"
Response.Write "<td>" & arrValues(i) & "</td>"
Response.Write "</tr>"
END IF
NEXT
Response.Write "</Table></center>"
End Sub
' This function 'should' add the same response data above to the datatable "Transactions_TransactionLogVBSForm"
Sub AddReturnData(strMsg)
DIM adoConnection, strSQL
DIM arrValues(8)
SET adoConnection = Server.CreateObject("ADODB.Connection")
adoConnection.ConnectionString = "Driver={SQL Server}; Server=local\thePhile; Database=thePhile; UID=sa; PWD=xxx"
strSQL = "INSERT INTO Transactions_TransactionLogJSForm(TransactionType, TotalAmount, Name, CompanyName, ResponseType, ResponseCode, ResponseDescr, AuthCode, TraceNo)"
strSQL = strSQL & "VALUES(arrValues(0)=ParseString(strMsg, "pg_transaction_type="),"
strSQL = strSQL & "arrValues(1)=ParseString(strMsg,"pg_total_amount= "),arrValues(2)=ParseString(strMsg,"ecom_billto_po stal_name_first="),arrValues(3)=ParseString(strMsg ,"ecom_billto_postal_name_last="),"
strSQL = strSQL & "arrValues(4)=ParseString(strMsg,"pg_response_type ="),arrValues(5)=ParseString(strMsg,"pg_response_c ode="), arrValues(6)=ParseString(strMsg,"pg_response_descr iption="),"
strSQL = strSQL & "arrValues(7)=ParseString(strMsg,"pg_authorization _code="), arrValues(8)=ParseString(strMsg,"pg_trace_number=" ))"
adoConnection.Execute(strSQL)
adoConnection.Close
adoConnection = Nothing
End Sub
------------------
...I know the sub "AddReturnData" is wrong but I don't kow how because I don't normally write VBScript. I am up to the "VALUES..."
line of the strSQL and I'm geting the following error msg:
---------------
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/ThePhileVB/_check_purchase.asp, line 118, column 60
strSQL = strSQL & "VALUES(arrValues(0)=ParseString(strMsg, "pg_transaction_type="),"
-----------------------------------------------------------^
------------
...it seems like I might just have a syntax error, but don't know for sure.
Any suggestions how to fix this really appreciated.
Thx
Reid C.
Reid C.
__________________
Reid C.
|