Click here to Skip to main content
15,112,304 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have set multiple connection strings in web.config file.
I want to fetch the currently running connection string in my web form. Currently my application is getting logged out and i am able to log in only after restarting the IIS.

What I have tried:

I have set multiple connection strings in web.config file.
<pre> <add name="MyConnectionString" connectionString="Data Source=BA_DB_SRV\BAS_DDS;Initial Catalog=DDSEDGE_ADIB_DEV;Persist Security Info=True;User ID=DDS_USER;Password=password1#;" providerName="System.Data.SqlClient"/>
    <add name="MySybaseConnectionString" connectionString="Provider=XXXXXXXX;Data source=XX.X.X.XXX:XXXX;Initial Catalog=XXXXX;User ID=XXXXXXXX;Password=XXXXXXXX"/>
Posted
Updated 23-Mar-21 20:24pm
Comments
lmoelleb 24-Mar-21 7:54am
   
Are you disposing everything related to the database that implements IDisposable?

1 solution

There is no such thing as the "currently running connection string".

Whatever connection string is being used is determined by your own code. Where you have "MyConnectionString", or whatever names you've given them, references in your code is what determines which string are being used.

I've got a site running at work that uses four connection strings, all pointing to different databases that the app uses for various operations.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900