Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to go through all the connectionstrings, if possible only the one I entered in the app.config. I found that although I only entered 2 connectionstrings, the count is 5.

But that is not the real problem, since I can always test on the provider (if someone knows a better solution, please feel free).

 

My problem is that I can't get the for each loop to work.

 

I tried

foreach (string myConnection in System.Configuration.ConfigurationSettings.ConnectionStrings)
    MessageBox.Show(myConnection);

but that does not work.

  • Administrators
Posted

firstly could you show the app.config file - it may make things clearer.

 

Also not sure what you mean by

go through all the connectionstrings, if possible ofig file?nly the one I entered in the app.config

are you storing connection strings anywhere other than the .con

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

What I mean is that when I look at the app.config there are only 2 files in there;

while the System.Configuration.ConfigurationSettings.ConnectionStrings.Count that is 5.

 

Here is my app.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <connectionStrings>
   <add name="Address" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Mijn documenten\Visual Studio\Projects\MNL Test Application\Database\Address.mdb;Persist Security Info=True" providerName="System.Data.OleDb" />
   <add name="Location" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Administrator\Mijn documenten\Visual Studio\Projects\MNL Test Application\Database\Location.mdb;Persist Security Info=True" providerName="System.Data.OleDb" />
 </connectionStrings>
</configuration>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...