Access DB distribution

Hi all.

I have developed a simple VB.NET app that displays some data from an Access database. No updating, just reading the data.

I want to distribute the db with the installation, I know how to include it in the user's application folder, but how do I make the app know where to look once it's installed (maybe |DataDirectory| )

I've been searching through other postings for a few days, but they all seem to be using VS 2005...

Thanks for any help!

P.S. I'm using Visual Studio 2003



Answer this question

Access DB distribution

  • bk13

    Or use Environment.CommandLineArgs... you can put it anywhere you want then... :)

  • Alvin Kuiper


    DataDirectory is new to 2005. Where are you installing the database If it's in your application folder or in an application subfolder you could use Application.StartupPath.

  • nabeelfarid

    Thanks!

    That answers my question.


  • zviaa

    Yes, it will be in the application folder. Do I use Application.StartupPath in the connection string
  • Rafet

    Yes, you can use it when building your connection string if it's in the same folder as your application executable:

    Dim ConnectionString As String

    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\MyDB.mdb"



  • Espriella

    Why not just use the file name if it's in the same directory:

    Dim ConnectionString As String

    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=MyDB.mdb"



  • Access DB distribution