I used the index for quickness. If I specify the name I get the following error:
"GetData Object reference not set to an instance of an object."
This is based on the following line of code:
Dim strConnectionString As String = ConfigurationManager.ConnectionStrings("DSWCConnec tionString").ConnectionString
The reason for this is that the ("DSWCConnectionString") exists in web.config but not app.config (which is correct as the web service is only added to the desktop project for debugging)
If I specify 0 it picks up the connection string from app.config.
More Info. (Just incase I am not making myself clear)
I am developing a desktop app that sends and receives data to a web service which I am also developing.
I have one solution which includes the Web Service project and the Desktop project. I have added a reference to the web service project to my desktop project.
The code I am having trouble with is the GetData function in the Web Service Project. (This is where I use the ConfirgurationManager.Conn... code)
Instead of picking up from Web.Config in that project, the connection string returned is from the App.Config file in my desktop project.
Hope this is more clear.