adapter and multiple connection strings

Posts   
 
    
Posts: 12
Joined: 14-May-2006
# Posted on: 20-Sep-2006 17:26:38   

I need to specify different connection strings for each adapter and I've had a look around and I can't seem to work out if this is possible or not!

using (DataAccessAdapter adapter = new DataAccessAdapter("SQl2000.ConnectionString"))
            {
                adapter.FetchEntityCollection(e.ContainedCollection, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter);
            }

and

using (DataAccessAdapter adapter = new DataAccessAdapter("SQl2005.ConnectionString"))
            {
                adapter.FetchEntityCollection(e.ContainedCollection, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter);
            }

Where both are set in the connectionStrings in the web.config

Thanks

Richard

pilotboba
User
Posts: 434
Joined: 05-Aug-2005
# Posted on: 20-Sep-2006 18:33:45   

I believe you have to pass in the actual Connection String to the constructor...


DataAccessAdapter adapter = new DataAccessAdapter(
     ConfigurationManager.ConnectionStrings["SQl2000.ConnectionString"].ConnectionString);

BOb