Database path when deploying .net application
Hi everyone,
I'm a newbie both to VB.NET 2003 and ado.net. Please bare with me :cry:
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. :thumb: :thumb: :thumb:
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. :cry:
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
Re: Database path when deploying .net application
" ... Data Source = " & Application.StartupPath & "\sample.mdb; ..."
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. :cry:
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.