Link to home
Start Free TrialLog in
Avatar of Prysson
Prysson

asked on

Help overriding tableadapter connection string in c#

I am trying to override the default connection string in a table adapter with a string that gets built using the connectionstringbuilder

            SqlConnection c = ConnStrBuilder.BuildConnection(orgid);
            tvEventLocationsPlusNamesTableAdapter tvELNByEventAdapt = new tvEventLocationsPlusNamesTableAdapter();
            tvELNByEventAdapt.Connection = c;

This little snippet is what my current code is but it returns an error because the tvELNByEventAdapt doesnt contain a definition for 'Connection'.

What is  the correct way for me to override the default connection string for the table adapter so that its using the correct connection string?

Avatar of Gautham Janardhan
Gautham Janardhan

i think u will have to do

tvELNByEventAdapt.SelectCommand.Connection = c;

si,ilarly for inserte, update and delete commands
Avatar of Prysson

ASKER

THat just gives me the same error about not containing a definition.

ASKER CERTIFIED SOLUTION
Avatar of Prysson
Prysson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial