none
How to include MS access database when publishing projects vb 2008 RRS feed

  • Question

  • I have a database that works fine when not yet published, I connect this way:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Network_Info.mdb"

    But when I publish my project my application can't find my database and I always get an error. Any solution to this matter?
    Wednesday, February 24, 2010 5:37 PM

Answers

  • If this is to be a local client DB then in the solution explorer right click on the .mdb -> Properties. Set Copy to Output Directory = Copy Always/Copy if Newer
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:32 AM
    • Marked as answer by Aland Li Friday, March 5, 2010 7:04 AM
    Wednesday, February 24, 2010 11:49 PM
  • Hi korae,

    You can follow JMyster's suggestion:
    1. Add the mdb file to your project by right clicking the project and select "Add -> Existing Item...".
    2. Set below properties:
        Build Action: Content;
        Copy to Output Directory: Copy always.
    3. Click the 'Application Files' button on the Publish tab to see if the file is included. If not, set 'Public Status' to 'Include'.

    Let me know if this does not help.
    Aland Li

    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by Aland Li Friday, March 5, 2010 7:04 AM
    Friday, February 26, 2010 7:37 AM

All replies

  • Hello,

    Are you adding it as a resource?

    When publishing, it will only grab your output files and any other file that you custom select.

    Adam
    Dibble and dabble but please don't babble.
    Wednesday, February 24, 2010 5:49 PM
  • If this is to be a local client DB then in the solution explorer right click on the .mdb -> Properties. Set Copy to Output Directory = Copy Always/Copy if Newer
    • Proposed as answer by Aland Li Friday, February 26, 2010 7:32 AM
    • Marked as answer by Aland Li Friday, March 5, 2010 7:04 AM
    Wednesday, February 24, 2010 11:49 PM
  • I have my database in my Bin->Debug folder but still it won't copy my database when published.
    Thursday, February 25, 2010 2:50 AM
  • Hi korae,

    You can follow JMyster's suggestion:
    1. Add the mdb file to your project by right clicking the project and select "Add -> Existing Item...".
    2. Set below properties:
        Build Action: Content;
        Copy to Output Directory: Copy always.
    3. Click the 'Application Files' button on the Publish tab to see if the file is included. If not, set 'Public Status' to 'Include'.

    Let me know if this does not help.
    Aland Li

    Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
    • Marked as answer by Aland Li Friday, March 5, 2010 7:04 AM
    Friday, February 26, 2010 7:37 AM
  • bro it dose`nt help me 
    Sunday, October 18, 2015 6:30 PM
  • Thanks for the solution

    but when I saw database was included in output directory

    then I even set the same properties to my dataset and then it worked fine

    Thanks once again

    keep it up

    Tuesday, April 7, 2020 2:38 AM