Database File Connection String in the Application Settings - Deploy Nightmare

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mfuribondo
    New Member
    • Feb 2008
    • 2

    Database File Connection String in the Application Settings - Deploy Nightmare

    I have a solution with three projects in it. Two are windows forms applications and the third is a class library. I am trying to deploy the projects which use a single database located in one of the windows forms applications projects. the connetion string to the database resides in the Application Settings of the class library project. I need to change the connection string located in the application settings to match the path that the users installs the application to. right now, the application settings are not changed at all and the application is looking for the database on the path that i set on me dev computer.

    Here is the value of the application setting:
    Data Source=.\SQLEXP RESS;AttachDbFi lename="C:\Docu ments and Settings\Mfurib ondo\My Documents\Visua l Studio 2005\Projects\P roj - GEMSoft Version 1\GemSoft\OTCAp plication\Datab ase\GEMSoft_Dat abase.mdf";Inte grated Security=True;C onnect Timeout=30;User Instance=True


    You can see that it is looking on my local dev computer.



    In short, i am looking for the best way to deploy a project that uses an internal database file and connection string.

    any suggestions are greatly appreciated.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    What if you made it say this:

    Data Source=.\SQLEXP RESS;AttachDbFi lename="GEMSoft _Database .mdf";Integrate d Security=True;C onnect Timeout=30;User Instance=True

    Then it would look in the same directory as the .exe to find the .mdf file?

    Comment

    • Shashi Sadasivan
      Recognized Expert Top Contributor
      • Aug 2007
      • 1435

      #3
      There is a way to include an external app.config file
      using the appsettings tag within the configuration tag

      This link explains how to do it

      Comment

      Working...