These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Simple Insert SQL

kaushiksriram100
Registered: Jun 23 2010
Posts: 9

I am trying to write an insert query like this -
 
Database.ExecSQL("INSERT INTO wf_GiftForms (Vendor, Form, scannedindex, SubmitDate, Total, LinkIndex, Acct, Name, Amnt, Mailing1, Mailing2, Mailing3, Mailing4, USERID, SpecialInstructions) VALUES ('" + Name.rawValue + "', 'QPQs', '" + MaxIndex.rawValue + "', '" + SubmitDate.rawValue + "', '" + string3 + "', '" + string4 + "', '" + Advance_Account_Number.rawValue + "', '" + Advance_Account_Name.rawValue + "', '" + string3 + "', '" + Street.rawValue + "', '" + City.rawValue + "', '" + State1.rawValue + "', '" + Zip.rawValue + "', '" + EmailAddress.rawValue + "', '" + Special_Gift_Instructions_2.rawValue + "');");
 
I am trying to take inputs entered in the pdf form and insert it to a table in SQL Server.
 
The problem comes when I use quotations(' and "") in any of the fields - Say I use name (here Vendor) as John's then the query fails to insert. Any comments? I am using Adobe Live cycle designer and Javascript.
 
Looking for someone who can help me..
 
Thanks,
kaushik

- Kaushik...

:)

My Product Information:
LiveCycle Designer, Windows
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Have you tried to use the JavaScript "Escape" character, "\", to enclose the quotation marks you are trying to pass as part of a string parameter?

Database.ExecSQL("INSERT INTO wf_GiftForms (Vendor, Form, scannedindex, SubmitDate, Total, LinkIndex, Acct, Name, Amnt, Mailing1, Mailing2, Mailing3, Mailing4, USERID, SpecialInstructions) VALUES (\"'\" + Name.rawValue + \"'\", 'QPQs', \"'\" + MaxIndex.rawValue + \"'\", \"'\" + SubmitDate.rawValue + \"'\", \"'\" + string3 + \"'\", \"'\" + string4 + \"'\", \"'\" + Advance_Account_Number.rawValue + \"'\", \"'\" + Advance_Account_Name.rawValue + \"'", \"'\" + string3 \"'\", \"'\" + Street.rawValue + \"'\", \"'\" + City.rawValue + \"'\", \"'\" + State1.rawValue + \"'\", \"'\" + Zip.rawValue + \"'\", \"'\" + EmailAddress.rawValue + \"'\", \"'\" + Special_Gift_Instructions_2.rawValue + \"'\");");


George Kaiser

kaushiksriram100
Registered: Jun 23 2010
Posts: 9
I tried the query mentioned above with the escape character. Now it doesn't even initiates the insert statement. I don't see the '+' sign in blue color which I used to see earlier. But I think we are getting closer, just missing something. (i did correct the string3 in the query above and added a +)

- Kaushik...

:)