Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. connection string

connection string

Scheduled Pinned Locked Moved Visual Basic
questiondatabasehelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    biott
    wrote on last edited by
    #1

    Hi i've made a connection object with ConnectionString that looks like: "Data Source= C:\...." the problem is that when i an installation of that program it looks for the database file in the specific location that i wrote in the connection string. how can i make the connection string so it'll turn to the database in the same directory where the app's EXE is located?

    H 1 Reply Last reply
    0
    • B biott

      Hi i've made a connection object with ConnectionString that looks like: "Data Source= C:\...." the problem is that when i an installation of that program it looks for the database file in the specific location that i wrote in the connection string. how can i make the connection string so it'll turn to the database in the same directory where the app's EXE is located?

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Hi,, If you use VB6 use App.Path to get the EXE folder. "DataSource=" & App.Path & "\FileName.mdb;......."

      B 1 Reply Last reply
      0
      • H Hesham Amin

        Hi,, If you use VB6 use App.Path to get the EXE folder. "DataSource=" & App.Path & "\FileName.mdb;......."

        B Offline
        B Offline
        biott
        wrote on last edited by
        #3

        and if i use vb.net?

        C 1 Reply Last reply
        0
        • B biott

          and if i use vb.net?

          C Offline
          C Offline
          Csharp
          wrote on last edited by
          #4

          Dim strPath As String = Application.StartupPath & "\db4.mdb" Dim Connection As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath Application.StartupPath being the app's path ( like App.Path in vb6 ) hope it helps.:)

          Csharp™  the coder formally known as dynamic


          Dim TwinsHaveArrived As String = "twins arrived safely , 17/08/2003 (18:05 & 18:07)"


          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups