How can I change DataAccessTier connection string at runtime from the PresentationTier? (based on N-Tier Walkthrough example) RRS feed

  • Question

  • I have created an nTier application using Creating an N-Tier Data Application

    The application consists of a DataAccessTier (contains the XSD where the connection is set), aDataEntityTier that contains the Dataset.Designer.vb, a WCF DataService tier, andPresentationTier.

    The PresentationTier contains a reference to the DataEntityTier, but not to the DataAccessTier. I think this is a requirement of clean n-Tier design.

    In the DataAccessTier is an app.config containing the connection string. The connection string is also stored in the DataAccessTier Settings.

    I want to be able to change the DataAccessTier connection at runtime, so the user can select a different database. Restarting the application after the change is OK.

    I may be able to modify the app.config file, but the DataAccessTier Setting for the connection string appears to be stored separately in MySettings on the DataAccessTier project.

    Can the connection string be updated from the PresentationTier? What is the clean way to do this?

    • Moved by Amanda Zhu Tuesday, October 29, 2013 6:39 AM
    Friday, October 25, 2013 8:09 PM

All replies

  • Hi,

    I have moved this thread to ADO.NET DataSet forum for better response.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 29, 2013 6:40 AM