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. datasourcing

datasourcing

Scheduled Pinned Locked Moved Visual Basic
helpcsharpdatabasevisual-studio
10 Posts 4 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.
  • R Offline
    R Offline
    rajulama
    wrote on last edited by
    #1

    Hi, I am having a very simple problem perhaps. I am using visual studio 2008 and have input an access data file called db1.mdb from hard disk. This contains a file called Sheet1. I would like to connect to that database from my form. I am using following code which says connection failure. My file contain no password and username.

    Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=db1.mdb")

    Please help me

    L N 2 Replies Last reply
    0
    • R rajulama

      Hi, I am having a very simple problem perhaps. I am using visual studio 2008 and have input an access data file called db1.mdb from hard disk. This contains a file called Sheet1. I would like to connect to that database from my form. I am using following code which says connection failure. My file contain no password and username.

      Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=db1.mdb")

      Please help me

      L Offline
      L Offline
      Luc 648011
      wrote on last edited by
      #2

      is the .mdb file in the same folder your .exe is in??

      R 1 Reply Last reply
      0
      • L Luc 648011

        is the .mdb file in the same folder your .exe is in??

        R Offline
        R Offline
        rajulama
        wrote on last edited by
        #3

        yes

        L 1 Reply Last reply
        0
        • R rajulama

          yes

          L Offline
          L Offline
          Luc 648011
          wrote on last edited by
          #4

          OK, then try - adding a semi-colon - adding a default account and empty password - adding an empty account and password - using full path This works for me: connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+file+";User Id=admin;Password=;"; where file is a string containing the full path. This article is an introduction to using MDB files: Using ADO.NET for beginners[^] :)

          1 Reply Last reply
          0
          • R rajulama

            Hi, I am having a very simple problem perhaps. I am using visual studio 2008 and have input an access data file called db1.mdb from hard disk. This contains a file called Sheet1. I would like to connect to that database from my form. I am using following code which says connection failure. My file contain no password and username.

            Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source=db1.mdb")

            Please help me

            N Offline
            N Offline
            Naji El Kotob
            wrote on last edited by
            #5

            Hi, Try "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db1.mdb" good luck :) NajiCo

            NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

            D R 2 Replies Last reply
            0
            • N Naji El Kotob

              Hi, Try "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db1.mdb" good luck :) NajiCo

              NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              That works for ClickOnce deployed applications. If you're not using ClickOnce, it's pretty much useless.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007, 2008

              N 1 Reply Last reply
              0
              • D Dave Kreskowiak

                That works for ClickOnce deployed applications. If you're not using ClickOnce, it's pretty much useless.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                N Offline
                N Offline
                Naji El Kotob
                wrote on last edited by
                #7

                Hi Dave, Actualy, using "|DataDirectory|" is very helpful to locate a database in the app's folder, it's not restricted to ClickOnce, just give it a try! best regards, NajiCo

                NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

                D 1 Reply Last reply
                0
                • N Naji El Kotob

                  Hi Dave, Actualy, using "|DataDirectory|" is very helpful to locate a database in the app's folder, it's not restricted to ClickOnce, just give it a try! best regards, NajiCo

                  NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

                  D Offline
                  D Offline
                  Dave Kreskowiak
                  wrote on last edited by
                  #8

                  Naji El Kotob wrote:

                  is very helpful to locate a database in the app's folder

                  That's the one place I never put a database. In most corporate environments I've been in, Program Files is ReadOnly, unless absolutely necessary.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  1 Reply Last reply
                  0
                  • N Naji El Kotob

                    Hi, Try "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\db1.mdb" good luck :) NajiCo

                    NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

                    R Offline
                    R Offline
                    rajulama
                    wrote on last edited by
                    #9

                    thanks I am done with it

                    N 1 Reply Last reply
                    0
                    • R rajulama

                      thanks I am done with it

                      N Offline
                      N Offline
                      Naji El Kotob
                      wrote on last edited by
                      #10

                      Hi, Great :) ... on the other hand, check Dave's comment regarding the location of database! best regards,

                      NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice... http://www.facebook.com/group.php?gid=5932660937[^]

                      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