Results 1 to 12 of 12

Thread: Question On Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254

    Question On Database

    Whenever i shift my whole project to another foreign computer i will encounter error on saying that my access file is not found and i have to rebuild the link all the time is there anyway i can put the link so that it dun search for the excat path but the folder where my .vbp is in ????

  2. #2
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    create the databaaaase in the same folder as your Project and use App.Path in the connection string

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    app.path???

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    Use App.path in the connection string

    App.Path gives you the folder of your application.

    SO when you cut paste this folder on some other machine, it wouldnt lose its links.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um sorry but i dun really get u what u mean by app.path??? u mean i add this line inside the connection string????

  6. #6
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    See maybe you have a connection string like this one:

    Code:
    strConnectionString = "Provider=Microsoft.OLEDB.jet.4.0; data Source = C:\MYfolder\database\Mydb.MDB"
    instead of this use it like this:

    Code:
    strConnectionString = "Provider=Microsoft.OLEDB.jet.4.0; data Source = " & App.Path & "\MyDB.mdb"

  7. #7
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Hmm...

    Originally posted by baby
    um sorry but i dun really get u what u mean by app.path??? u mean i add this line inside the connection string????
    will look something like this...

    VB Code:
    1. strConnectionLocation = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    2.                         "Data Source=" & App.Path & "\CSSTS.mdb;" & _
    3.                         "Persist Security Info=False"

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    OK THANX ALOT GUYS

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    after trying out lots and lots of time i still cant get it to work

    my connection liner is as follows:


    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\VisualBasic\project\training.mdb;Persist Security Info=False

  10. #10
    Frenzied Member dj4uk's Avatar
    Join Date
    Aug 2002
    Location
    Birmingham, UK Lobotomies: 3
    Posts
    1,131
    For it to work you must have the database in the same directory as the application - app.path is the path to the application not the database.

  11. #11
    Let me in .. techyspecy's Avatar
    Join Date
    Aug 2002
    Location
    Back to VBF.
    Posts
    2,456
    Jesus Christ Baby,

    These guys exaplained what needs to be done, and you are still doing what you were doing earlier.

    Just include the app.path while you are specifying the database path in your connection string. And you keep your database where your application file(s) are on the Hard Drive. What that does for you is It looks for that database file in the same folder where your application files are. So that you can just keep your MDB file in the same folder. And you do not have to hard code the path in your connection string.

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Singapore
    Posts
    254
    um guys i think i solved it already JUST put the filename without the path of the file name will do

    thanx for all the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width