VB.net database connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    VB.net database connection

    Hi I'm using vb.net trying to use the 'app.path' to connect to my database.

    Problem i'm getting is...

    When i run the program, it tries to find my database in ...\bin\debug\* mdb
    yet my .bmd file is in the project folder with all othe forms the program uses.

    How can i change this path that my program uses to connect to my database?

    Thanks

    James
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    App.path means the path of the EXE file.

    U need to change accordingly to your requirment.

    Comment

    • jamesd0142
      Contributor
      • Sep 2007
      • 471

      #3
      Hi thanks for the reply,

      While I'm here could you help me im new to this and compltely confused.

      I have a database called FAQs.mdb and my program connects to it using:
      Dim Con As OleDb.OleDbConn ection
      Con = New OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OleDb.4.0;data source=" & Application.Sta rtupPath & "\FAQs.mdb" )

      No my database is located in my projectfolder.. .\bin\debug

      When i run the program in visual studio, it works perfectly.

      Although...

      When i publish my program the database doesnt seem to get copied with the rest of the program.

      Why is this? OR Better still Where should i save the *.mdb file?

      Thanks James

      Comment

      Working...