How to dynamically change the connection string?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • GR M
    New Member
    • Dec 2010
    • 19

    How to dynamically change the connection string?

    Hi..
    Do consider my thought. I want to write my connection string in such away that it fits in the environment of database back up and restore. i.e. Most of time we do use hardcoded connection string. But if the user restores the backed up database to some other drive due to some reason or changes the restored database file name to his will, our whole program will crash. So, I invite some thoughts & lights on whether we could write the connection sting in such a way that it'll fit into these environment or suggest possible logic. Thanks in advance.
  • Joseph Martell
    Recognized Expert New Member
    • Jan 2010
    • 198

    #2
    The biggest problem that I see with your situation is that you have no real control over where the user will restore the database to. You really need a connection string stored in a config file, or at least part of a connection string. That way the user can modify the connection string to point to their specific location.

    Comment

    Working...