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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. problem in connection string in vb.net1.1

problem in connection string in vb.net1.1

Scheduled Pinned Locked Moved Visual Basic
helpcsharpvisual-studio
3 Posts 2 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.
  • A Offline
    A Offline
    amaneet
    wrote on last edited by
    #1

    Sir, I am using connection string in the following format Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication1\db1.mdb" But when I use connection string in the following format it shows error and connection does not get establishment. Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=WindowsApplication1\db1.mdb" I don't want to declare the full path. Please help me Thanks and Regards amaneet Brar

    S 1 Reply Last reply
    0
    • A amaneet

      Sir, I am using connection string in the following format Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=C:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\WindowsApplication1\db1.mdb" But when I use connection string in the following format it shows error and connection does not get establishment. Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=WindowsApplication1\db1.mdb" I don't want to declare the full path. Please help me Thanks and Regards amaneet Brar

      S Offline
      S Offline
      Steve Pullan
      wrote on last edited by
      #2

      amaneet wrote:

      I don't want to declare the full path.

      Then try this (assuming that the MDB is in the application path): Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=" & Application.StartupPath & "db1.mdb" ...Steve 1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)

      A 1 Reply Last reply
      0
      • S Steve Pullan

        amaneet wrote:

        I don't want to declare the full path.

        Then try this (assuming that the MDB is in the application path): Dim cnstr As String = "Provider=Microsoft.Jet.Oledb.4.0;data source=" & Application.StartupPath & "db1.mdb" ...Steve 1. quod erat demonstrandum 2. "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." I read that somewhere once :-)

        A Offline
        A Offline
        amaneet
        wrote on last edited by
        #3

        Thank You

        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