Results 1 to 3 of 3

Thread: Database path when deploying .net application

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2007
    Posts
    8

    Question Database path when deploying .net application

    Hi everyone,
    I'm a newbie both to VB.NET 2003 and ado.net. Please bare with me

    Thanks to mendhak's ado tutorial (http://www.vbforums.com/showthread.php?t=466658), I have managed to understand a bit how ado.net works.

    I got a small application code running where I read records from an access database. It works fine.

    However, my concern is that when I use the deployment option of vb.net, I would like to include the database file. If the user installs it in a path which is different from the path I got in my code (e.g: c:\mdb), the program will not work.

    At the moment I use the following code:
    conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mdb\sample.mdb;User Id=admin;Password=;"

    Is there a way I can use a special variable to use the same path were the EXE file is residing to load the database file?

    E.g: If the exe file is installed in c:\program files\tool, the database will be installed in the same path and the code would load it from there.

    Can please someone help out a poor newbie who is lost in confusion :-(

    Thanks in advance

  2. #2
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: Database path when deploying .net application

    " ... Data Source = " & Application.StartupPath & "\sample.mdb; ..."
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Database path when deploying .net application

    Quote Originally Posted by blackbox
    However, my concern is that when I use the deployment option of vb.net, I would like to include the database file. If the user installs it in a path which is different from the path I got in my code (e.g: c:\mdb), the program will not work.
    This is a legitimate concern, and would happen.

    I would suggest including a document with your installation package in which you specifiy the parameters around which your application needs to be installed in order to function properly.

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