Need to Dynamically Change DataSource of TableAdapters RRS feed

  • Question

  • We are using Visual Studio 2008 and VB.net


    We have several tableadapters that are utilizing db2 tables via odbc connection. We have three distinct environments; Test, QA, and Production, that have tables represented by T.xxxxx, Q.xxxxx, and P.xxxxx, repectively. We have discovered a way to change and propogate the connection string for each environment via code and a form with a combo box.

     However, we have not discovered a way to dynamically change the tableadapter to reflect the chosen environment. The workaround that we are using now is to change the app.config file so that the environment we want is hardcoded as the "connection string" value and we have manually changed the table name (T. xxxxx to Q.xxxxx to P.xxxxx) for each tableadapter. This is followed by a rebuild and then deployment.

    Is there a way to do this via code? We have seached the internet for several days and have only been able to find examples of dynamically changing the SQl but not the datasource table for the tableadapter.


    Any help is greatly appreciated!



    Tuesday, October 26, 2010 9:39 PM

All replies

  • Can you provide some additional details? Are you trying to extend or automate the VS IDE somehow? I'm afraid I don't have a good idea as to what you are doing here.


    Ed Dore
    Wednesday, November 3, 2010 10:38 PM