Results 1 to 2 of 2

Thread: path for database in connection string

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2001
    Posts
    1,331

    path for database in connection string

    Hello,

    I have a database application in my connection string l have the following.

    OleDbConnection cnnTeacher = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Library\LibrarySystem.mdb;Persist Security Info=False");

    But if want to install this program on another machine l don't want to have to change every connection string. Is there an easy way to do this.

    The database is in the same folder that the solution is in.

    Thanks in advance,

    Steve
    steve

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Two ideas come to mind, probably others as well. One, if you're sure it's in the same place as the executable, you can use Application.StartupPath or for more flexibility, stick it in the .config file and grab it through code with the ConfigurationSettings class.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width