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

SOLVED

can I change xfa.sourceSet.DataConnection.connect.connectString.value

Avatar

Level 3

On LC Designer, I set up a data connection called DataConnection1 to access a certain file named a001.xls,

Here is the xml shows:

<sourceSet xmlns="http://www.xfa.org/schema/xfa-source-set/1.0/">
   <source name="DataConnection1" db="ado">
      <connect delayedOpen="1" timeout="15">
         <connectString>Provider=MSDASQL.1;Persist Security Info=False;Data Source=Excel Files;Mode=Read;Extended Properties="DSN=Excel Files;DBQ=C:\a001.xls;DefaultDir=C:;DriverId=790;MaxBufferSize=2048;PageTimeout=5;"</connectString>
         <user/>
         <password/>
      </connect>
      <command timeout="30">

-----------------------

I can display the value of xfa.sourceSet.DataConnection1.connect.connectString.value which shows above string.

Now I change the connectString via a button click such that I can use another file named a002.xls for the data connection by :

new_connStr = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=Excel Files;Mode=Read;Extended Properties=\"DSN=Excel Files;DBQ=C:\\a002.xls;DefaultDir=C:;DriverId=790;MaxBufferSize=2048;PageTimeout=5;\"";

xfa.sourceSet.DataConnection1.connect.connectString.value =  new_connStr;

Then when I display the value again, it still remains the same old connect string value.

Any ideas?

Rgds.

1 Accepted Solution

Avatar

Correct answer by
Level 10

The sourceSet is locked down after the form is rendered. It is a security violation to change it after rendering. If you open the javascript console I am sure you will see a security violation error.

Paul

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

The sourceSet is locked down after the form is rendered. It is a security violation to change it after rendering. If you open the javascript console I am sure you will see a security violation error.

Paul