Page 1 of 1

ConnectionString in app.config

Posted: Fri 11 Dec 2009 15:14
by degas
I have a small problem that is not crucial but is a bit annoying. I have been using your components for a WinForms application.
I am usign the InterFormLink component (wich is great by the way!!) and only 1 OracleConnection component for all my solution. The connection string is define in the app.config.
When the program excecutes, it shows a login form and ask the user for credentials. Those credentials should open the ConnectionString mentioned above. In other words, my users are OracleSchemas. This way i have security integrated with Oracle.

The problem is that the OracleConnection harcoded in the Designer.cs code so i cannot changed.
Is there a way to overcome this problem?

Posted: Mon 14 Dec 2009 12:32
by StanislavK
You can set a reference to the connection put on another form either at design-time or at run-time. At design-time you can refer to the connection by some other component (like OracleDataTable) and then edit OracleDataTable.Connection. At run-time you can get the connection directly like this:

Code: Select all

OracleConnection con = (OracleConnection)Devart.Common.GlobalComponentsCache.GetObjectByName ("YourDataForm.YourConnection");
Please let us know if this helped.

Posted: Mon 14 Dec 2009 13:04
by degas
Your solution works fine, but the i have the problem of setting all the Connections again for every DataTable i have.
This may cause error, because if i don`t set the OracleConnection, everything will run ok, because it is still taking the connection of the designer.
But on a production enviorment will not work.

What i wanted to do, was to be able to change the Connection that the designer is using at runtime.

Posted: Tue 15 Dec 2009 09:03
by StanislavK
Could you please send us a small project with the problem?

As far as I could understand, you are using the only OracleConnection for multiple DataTables and this connection is somehow set at design-time. Since OracleConnection is a reference type, its properties can be changed once in any DataTable.Connection and this will affect all other DataTables. Please let me know if I've missed something.