Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tableadapter and connection string

Status
Not open for further replies.

ecannizzo

Programmer
Sep 19, 2000
213
US
I have some code like below:

Code:
P_USERSTableAdapter adapter = new P_USERSTableAdapter();
            
adapter.Connection.ConnectionString = p_connectionString;

P_USERSDataTable table = adapter.FINDBYLOGINID(p_loginId);

There are 2 items in this tableadapter commandcollection. The regular Fill() and then FINDBYLOGINID(p_loginId).

When I set the connection string on the adapter it's only setting it for the first in the collection. The second in the collection is using the default connection string in the settings file. I would like to override the connection string for the whole commandcollection to the one I pass in which I thought I was doing with adapter.Connection.ConnectionString = p_connectionString;

Any help would be appreciated.
Thanks!
 
you may need to replace the entire connection, not the just the connection string. it doesn't make sense only to replace the connection string. this would allow an Oracle connection string for a SqlConnection object.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top