Expand my Community achievements bar.

Insert to database

Avatar

Level 3

Good day everyone,

On Friday I spent the whole day struggling to insert into my SQL database.

I created the DSN, I've checked the checkbox for Delayed Open, I tested my connection its successful and my five fields are bound I also tried not binding them but still nothing happens.

This is what I have in my click event

xfa.sourceSet.DataConnection.addNew(); I also tried first() instead of addNew but no success

I'm using my local database, SQL 2008.

Can someone please help, what am I missing.

Regards,

Ace

12 Replies

Avatar

Former Community Member

Are you using Reader or Acrobat to view the form?

Paul

Avatar

Level 3

Initially I thought the problem is with reader extension, then I reader extended it amd viewed it using Reader X, still no luck, no error message, nothing.

Ace

Avatar

Former Community Member

How did you Reader Extend it ....using Acrobat or Reader Extensions Server?

Paul

Avatar

Level 3

Reader Extensions Server with all options checked

Avatar

Former Community Member

OK so we have determined that the form is capable of doing data connections to a DB .....To add a new

record typically you woudl need to do it in two steps .....the addNew will create a blank record and the update record will insert the data that is bound to the named fields into the db.

This is very dependant on how your database works of course. For this reason I tend to use the method of creating my own SQL statement to do my update rather than using the predefined operations like addnew() and update()

Paul

Avatar

Level 3

I dont know Paul but I think my problem is bigger than that, because while searching for the solution I came across your 2 forms, ie database_showOneRecord and database_ShowMultipleRecord, I changed the connection so it can point to my own database and my own table, but I still couldnt get it to work.

Ace

Avatar

Former Community Member

Ok ...so lets go back to fundamentals and build up on  the solution from there .....can you create a form that will display a record from the DB for you? This will test and validate that we are actually communicating with teh DB. Then we will build it up from there.

paul

Avatar

Level 3

What I just did now, I inserted manually one record into the database and loaded form, I have all the buttons, First, Previous, Next, Last, AddNew, Update, Delete and Cancel and my fields are bound.

When I load the form it doesnt load with the data that is in the database, so I guess that will mean its not communicating with the db :-( ?

Ace

Avatar

Former Community Member

Yup .....did you turn off the delayed open?

Paul

Avatar

Level 3

I didnt turn it off, but I just did now and it populates the data  :-)

So what is wrong with adding or updating to the database?

Ace

Avatar

Former Community Member

Ok I think we shoudl take this off line ...can you send an email to LiveCycle8@gmail.com and we will continue it there.

Paul

Avatar

Level 3

I've just emailed it to you.

Thanks,

Ace