Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to insert data into a Database?

Avatar

Former Community Member
Dear All,



I am starting to become mad, Designer... Ahhhhhhh!



Ok, I have a great form with a Database connection, this connection has to be used for inserting and recovering data, I mean, once the customer open the pdf it tries to recover the data from the specified table (this works), once the customer modifies the data and close the pdf I attempt to insert the new data into the DB (just an insert! no more I promise)



My problem is, the first select * from... works perfectly:

...

DB.resolveNode("#command").query.commandType = 'text';

DB.resolveNode("#command").query.select.value = 'Select * from T2';

DB.open();

...



But when I try to insert the data (I have to perform several insert sentences) I get an error when I try to open the database. This is my code:

...

DB = xfa.sourceSet.ora1;

record = xfa.record.ora1;

DB.resolveNode("#command").query.commandType = 'text';

DB.resolveNode("#command").query.select.value = 'insert into t2 values (\'hello\',\'hello\')' ;

DB.resolveNode("#command").query.recordSet.setAttribute("stayBOF", "bofAction");

DB.resolveNode("#command").query.recordSet.setAttribute("stayEOF", "eofAction");

DB.open();

...



When the designer tries to open the database an error happen, but amazingly it inserts the data and after that show me this error:

GeneralError: Operation Error.

XFAObject.open:20:XFA:Formulario1[0].#subform[0].Botón1[1]:click

Adobe operation failed. The collection element that belongs to the name or the ordinal requested could not been found

(this is the english translation of the spanish error)



I have created a blank form, and the same error was shown. Also I have executed the insert directly in the database just to be sure and works perfectly.



Does anybody known whats wrong? Why the .open() fail after inserting the row? Does anybody has a simple sample?



Searching in the Forum I have found another way to do it, it is linking the database table fields to fields in the pdf and use the .addnew() method. So I have created the fields, I have linked it and created a button with the addnew() button. I write in the fields and click on the Button.... but nothing happens. Another time, what am I doing wrong here?



Any help will be apreciated, in two days I have to present it to my customers...



Thanks in Advance.

Ruben
53 Replies

Avatar

Former Community Member
Hi



Could anyone send me the sample of how to get form data to an MS Access database?



mandrade23@gmail.com

Avatar

Former Community Member
Hi



Could anyone send me the sample of how to get form data to an MS Access database also?



wayne.moore@usda.gov

Avatar

Former Community Member
Wow,



Someone must have solved this one.

I have the same "empty rows" post problem.



If a solution exists please email to:



tavener52@hotmail.com

Avatar

Former Community Member
Hi,

I am about to incorporate a form I built with Access DB, I was wondering if LHigbee would be kind enough to send the DB sample?

email to flatwiretech@gmail.com



TIA

Avatar

Former Community Member
can i have one too i am having loads of problems getting it to work

rdaniels@mass.co.uk

Avatar

Former Community Member
I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..



Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.



My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.



So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm



which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.



My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.



so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,



But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.



I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.



Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..



Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.



or how in the heck can i get this data from the DB into a blank PDF form, like i have described??



here are some link to reference



Populating a LiveCycle PDF with PHP and MySQL

http://www.andrewheiss.com/Tutorials?page=LiveCycle_PDFs_and_MySQL



HTML form that passed data into a PDF

http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.html

and an example

http://accesspdf.com/html_pdf_form/

________________________________________

Avatar

Level 2
I know this is an old thread, but if anyone has an example they could send I would be eternally grateful. I have my Access DB connected to my form and it fills in beautifully with the information from the database. So I know that it is connected. I have followed all the tutorials I can find on inserting data into a database. When I click the button, I do not get an error but neither do I have the data inserted into my database. I am using Access 2007 and Livecycle ES 8.2. The form information only needs to be appended to a table in my database. The form and the database will always be on the same machine when this happens.



I thought this would be easy...



Oh, yeah... my Email is jdickens@dse.net



Thanx.



Jenn D.

Avatar

Level 1

If you don't mind, would you send this to jkolsen@u.arizona.edu?  Thanks!

Avatar

Former Community Member

Hi,
I am trying to incorporate a form I built with Access DB, I was wondering if LHigbee would be kind enough to send the DB sample? I will be a great help.
email to ldniit@yahoo.com

Thanks.

Avatar

Level 7

Hi

Could anyone send me the sample of how to get form data to an MS Access database also?

My email is printshop@baycrest.org

Thanks

Avatar

Former Community Member

Could Lynne or someone who has a copy please send me the sample using an ODBC Data Connection to a Microsoft Access database

I have been able to connect to the access file but manipulating the data seems to be a larger problem.  thank you.

soynv@yahoo.com

Avatar

Level 1

Hi Stephan ,

I am stuck in a situation where I am trying to Apply these DB operations using SQL server 2012.

I have created a DSN to access my database and I have created a simple form to store and fetch First name and Last Name of employee. I have created a Data Connection and able to fetch Records from database. I am only getting the first record from my database which is shown automatically on my binded form fields and I am using the following the Scripts to navigate to other records by applying click action to buttons.

xfa.sourceSet.ApplicationData.next(); // Application Data is my Data Connection Name

xfa.sourceSet.ApplicationData.addNew(); // To Add new record.

Both these scripts are not working and not returning anything using client JavaScript.  Please also see the attached form for more Info.

As I am using Trial version of Livecycle Designer ES4, so is it some limitation or am I missing something . Is it an issue of reader extension .

please let me know ASAP.

Thanks,

Vinay Mahajan

email :- vinay.mahajan25@gmail.com