NekoManu Posted August 20, 2004 Posted August 20, 2004 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. Quote
Administrators PlausiblyDamp Posted August 20, 2004 Administrators Posted August 20, 2004 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 Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
NekoManu Posted August 20, 2004 Author Posted August 20, 2004 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> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.