Thursday, January 10, 2013 7:41 PMDataContext context = new DataContext("portalConnectionString-Prod");
context = new DataContext("portalConnectionString-Test");
Is not working Why?
Thursday, January 10, 2013 9:25 PM
Please try it like this. You will need to add a reference to the dll file System.configuration.dll and the using statement:
string connStr = ConfigurationManager.ConnectionStrings["portalConnectionString-Prod"].ConnectionString; DataContext context = new DataContext(connStr);
If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
Friday, January 11, 2013 1:00 PM
When you passed portalConnectionString-Test as a paramtere to data context, it considered this string as a connection string.
The problem why your DataContext didn't work is that it recieved incorrect string as a connection string. Pass the correct connection string as a value and everything will work fine.
Please Mark as Reply and Vote as Helpful if I helped.
Also please visit my blog http://msguy.net/