none
Not able to connec to .accdb file after deploying from ClickOnce

    Question

  • My app.config file looks like this:

    <?

     

    xml version="1.0" encoding="utf-8" ?>

    <

     

    configuration>

    <

     

    configSections>

    </

     

    configSections>

    <

     

    connectionStrings>

    <

     

    add name="DhanalakshmiChits.Properties.Settings.CHITSConnectionString"

     

     

    connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database\CHITS.accdb"

     

     

    providerName="System.Data.OleDb" />

    <

     

    add name="DhanalakshmiChits.Properties.Settings.CHITSConnection"

     

     

    connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Database\CHITS.accdb"

     

     

    providerName="System.Data.OleDb" />

    </

     

    connectionStrings>

    </

     

    configuration>

    After Deploy, publish folder structure looks like this:
    DhanalakshmiChits_1_0_0_5\Database\CHITS.accdb.deploy
    DhanalakshmiChits_1_0_0_5\DhanalakshmiChits.application
    DhanalakshmiChits_1_0_0_5\DhanalakshmiChits.exe.config.deploy
    DhanalakshmiChits_1_0_0_5\DhanalakshmiChits.exe.deploy
    DhanalakshmiChits_1_0_0_5\DhanalakshmiChits.exe.manifest

    When I run the application after Deploying: I am getting this error:
    C:\Documents and Settings\l88510\Local Settings\Apps\2.0\W2HCO0J0.Y0V\XYHLQD55.5Q1\dhan..tion_0bb7e29fe14907be_0001.0000_a6ffc4cd64f64abe\Database\CHITS.accdb' is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.

    How should I rectify this problem?

    Friday, November 27, 2009 10:55 AM

Answers

  • When the user installs it, where does it put the database in the ClickOnce cache? Your connection string is set to pick it up from the Database folder in the Data Directory.

    And if you go into Application Files, is your database set to Include or Data?? If it's set to Data, then your database will be deployed to the DataDirectory, and I doubt it will create the Database folder under there, but I'm not sure.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Kira Qian Tuesday, December 15, 2009 9:30 AM
    Wednesday, December 02, 2009 5:54 PM
    Moderator

All replies

  • I am assuming that you have the database included in the project. Do you have the build action set to "content", and the "copy to output directory" set to 'copy always"? Plus, click on the Application Files dialog and check it out -- do you have that database file set to be Data or just Include? If you want it put in the data directory, you need to designate it as a data file.

    RobinDotNet


    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    Saturday, November 28, 2009 4:10 AM
    Moderator
  • I had already tried with all the setting what you have suggested. When I publish the application, CHITS.accdb file is getting deployed under the directory Publish_DhanalakshmiChits\Application Files\DhanalakshmiChits_1_0_0_6\Database.
    Wednesday, December 02, 2009 9:54 AM
  • When the user installs it, where does it put the database in the ClickOnce cache? Your connection string is set to pick it up from the Database folder in the Data Directory.

    And if you go into Application Files, is your database set to Include or Data?? If it's set to Data, then your database will be deployed to the DataDirectory, and I doubt it will create the Database folder under there, but I'm not sure.

    RobinDotNet
    Click here to visit my ClickOnce blog!
    Microsoft MVP, Client App Dev
    • Marked as answer by Kira Qian Tuesday, December 15, 2009 9:30 AM
    Wednesday, December 02, 2009 5:54 PM
    Moderator