Results 1 to 5 of 5

Thread: Database in VB.net HELP!!

  1. #1

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200

    Database in VB.net HELP!!

    ok i want to have a database that stores information to be deploied with my software, the database can be accessed perfectly on the computer i designed the software on but when i install the software on a different computer ithe software can not detect the database it is in a different location or something

    what i need to know is how can i make the software look in a file for the location of a database so when i install the program on a different computer they can specify were it goes but the software can find it.

    also when i access it from vb.net i use the jet 3.something to access an Access database. Thanks for your help!

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    49
    This is something I came across a while back on a project I was working on. I think your problem might be the connection string to your database. In your OleDbConnection object there is a property called ConnectionString. The parameters of it are huge, but the one you are looking for is 'Data Source'. By default, as it seems, the path to the database is absolute, making it completely useless considering the astronomically small chances of the end user installing the program to the same absolute path as it was developed in. If you change the path to being relative then that should fix your problem.

  3. #3
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    In your connection string, the path for your DB, use the app.path method or just type @"\mydb.mdb". It will look for the DB in the immediate folder.

  4. #4

    Thread Starter
    Addicted Member Buy2easy.com's Avatar
    Join Date
    Jul 2002
    Posts
    200
    thanks for the @"/mydata.db" can i make it just @"mydatabase.db" without the / and it look in the same folder as the program running?

  5. #5
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Yes you can do it that way too.

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