Dynamically change connection string on a TableAdapter

G

Guest

Hi,
How can I dynamically change the connection string on a TableAdapter. I'm
looking for a way in code to easily configure this setting.
Thanks for your help,
Terry
 
W

WenYuan Wang

Hi Terry.

I agree with Allen.
You can use TableAdapter.Connection property to change the connection
string for TableAdapter.
For example:
Table1TableAdapter t = new Table1TableAdapter();
t.Connection.ConnectionString = "Data Source=***;Initial
Catalog=***;Integrated Security=True";

Please try the method as above and let know whether or not this is what you
need. I'm glad to assist you.
Have a great day!
Wen Yuan
 
W

WenYuan Wang

Hi Terry,

I haven't heard from you two days. Just want to check if the issue has been
resolved?
If it still persists, please don't hesitate to update here.
We'll go on to assist you on it.

Have a great day
Wen Yuan
 
G

Guest

Hi Wen Yuan,
Thanks for following up. I understand the connection string solution but it
does not completely meet our needs. We are working through the issue now.
The approach that we are attempting to take is creating a seperate build
machine. On this build machine for each project we would like to catch the
pre-build event of the build process, in this event we are going to write out
the production connection strings to the app.config file. I will follow-up
with another email once we have completed this task.
Thanks again,
Terry
 
W

WenYuan Wang

Hi Terry,

Thanks very much for your reply. :) By the way, if you have met any
further question, you can also post it in newsgourp. I'm glad to assist
you.

Have a great day!
Wen Yuan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top