Reputation: 126
I have three connection strings in my config file. I want to detect the name of the connection string which is connected at the moment.
(All three databases are remote and have different purposes).
I want to detect the name at different places in my project.
Is it possible?
Upvotes: 0
Views: 675
Reputation: 4796
Here is the doc for OleDBConnection : https://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection%28v=vs.110%29.aspx
Use the property ConnectionString of that object to know which connection is used.
But if you have three different databases for different purpose, I would suggest to use three Connection objects...
Upvotes: 1