Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Database Connection

Avatar

Not applicable
Im new to working with Livecycle. I am attempting to connect to a SQL database. Im able to setup the connection easy enough and select the table i want to query, but when I enter the field in to the binding section and test it. the field only displays the first value. Ive tied it different ways with different types of objects (list box, combo box, ect) .any ideas what Im missing...?
64 Replies

Avatar

Level 10
When you create the connection in the Dataview by default the connection to the dB will happen when the form is loaded. Hence it will return the 1st record. In the data connection definition there is a delayed open checkbox on the last panel. If you check this off then you can control when the data connection happens. I have some samples that show how to get a SQL statement into the connection and cause it to open. If you post your email address I will send it to you.

Avatar

Level 7

Hi Paul, is it possible to send these  samples that show how to get a SQL statement into the connection ?

printshop@baycrest.org

Thanks

Avatar

Level 10

Those samples are posted in an early post on this thread. You should be able to grab them from there.

Paul

Avatar

Level 1

Hi Paul,

i'm trying to connect a SQL server DB using you code:

when open the form i still get the message "Connection failed becuse the

environment is not trusted" and when clicking on button i get the error:

GeneralError: Operation failed.

XFAObject.setAttribute:7:XFA:data[0]:#subform[0]:Button1[0]:click

Method: 'setAttribute' cannot be called because doing so would violate this document's permissions settings.

(I'm using Designer version 8.1.2)

Please help me (i'm going crazy with this!)

Regards

Luca

Avatar

Level 1

Hi Paul, thank you for quickly response.

Previous error was solved (simply sintax error).

But the "connection for source failed because the environment is not trusted" problem still remain.

I think the problem is the SQL server connection parameters settings.

Anybody has experience with SQL server sources?

(Paul: the form is a exact copy of yours, only source type changes)

Thanks in advance

In my last try i created a DSN on my pc, and i used ODBC drivers instead that SQL server drivers in the data connection settings.

When i open the form i get the message "Unable to create SOM expression $record.DataConnection.[fieldname]".

Message was edited by: Luca Macagnino

Avatar

Level 10

I posted this question earlier ...

So is the issue that no matter what department I choose the data is always the same? If so then in the SQL command that is executed on the exit of the DDlist does not have any variable component to it. This SQL is what is retrieving information from the DB for updating the fields. Normally the value the is selected in teh DDList is used in teh query to select data just for that item ....I do not see anything like that in the SQL statement....am I missing something?

Paul

Avatar

Level 7

Hi Paul,

The problem I have is:

In the drop down menu for example there are 3 Data selections for Department1.

When I select the first on the list Department1 the data I am getting is fine!

But when I select the second one from the list Department1 data does not update(Data from previous remains)!

My buttons work fine.

How I can solve the above problem?

Or there is a way to show up ALL data from a specific Department?

Thanks Paul for all your help

Avatar

Level 10

So is the issue that no matter what department I choose the data is always the same? If so then in the SQL command that is executed on the exit of the DDlist does not have any variable component to it. This SQL is what is retrieving information from the DB for updating the fields. Normally the value the is selected in teh DDList is used in teh query to select data just for that item ....I do not see anything like that in the SQL statement....am I missing something?

Paul

Avatar

Not applicable
Ive made my email address visable. Anything you can send me would be much appreciated.

Thanks

Avatar

Level 8
Level 8
Hi again Paul,



Could you share the code with me as well - or on the forum?



Sincerely

Kim

kc(at)dafolo.dk

Avatar

Level 8
Level 8
Hi again,



I have been fidling a little with "things", but I still haven't found what I am looking for.



I found one of your older posts with this essential content:



-----



1. First lets change the connection to accept a sql command instead of connecting and getting all records:



xfa.sourceSet.DataConnection.nodes.item(1).query.setAttribute("text", "commandType");



2. Now lets set the SQL command we want to execute:



xfa.sourceSet.DataConnection.nodes.item(1).query.select.nodes.item(0).value="Select * from Parts Where PART_NO = " + TextField1.rawValue;



3. Now we are ready to open the connection:



xfa.sourceSet.DataConnection.open()



-----



However I can't make it work in Acrobat 9, I get an error telling me the following:



GeneralError: Operation failed.

XFAObject.open:6:XFA:form1[0]:#subform[0]:Button1[1]:click

Connection for Source DataConnection failed because the environment is not trusted.



What can I do to go around this.



Sincerely

Kim

Avatar

Not applicable
Hi Paul,



Could you share the code with me as well my adress david.dol2007@yahoo.fr - or on the forum?



Thinks