none
data set is not sync with local data base RRS feed

  • Question

  • Hi, I have a local data base and a dataset which talks to it both in a windows application. But in my forms when I manipulate data, they don’t save permanently to data base. I think it’s because I didn’t set the “copy to output directory” and ”build Action” properties in both data set and data base items in solution explorer.so how should I set these properties in order to get right functionality. Or you think my problem would be something else? Thanks for helps.

    Wednesday, October 3, 2012 5:23 PM

Answers

  • Hi,

    Now your application can't able to find your db file. You can copy your data field directly to your debug folder. Now just check that when you run application you can able to access your database file.

    Open your folder location, go to debug folder and see if there is database file or not. If it's not there, please copy.


    Thanks and Regards, Shailesh B. Davara

    • Marked as answer by mortaza.mkr Saturday, October 13, 2012 4:25 PM
    Monday, October 8, 2012 4:12 AM
  • Thanks Shailesh B. Davara.

    after your helpful posts and reading this article I understanded what was happening.

    http://msdn.microsoft.com/en-us/library/ms246989(v=vs.100).aspx

    • Marked as answer by mortaza.mkr Saturday, October 13, 2012 4:25 PM
    Saturday, October 13, 2012 4:25 PM

All replies

  • Hi,

    you can set database property with your database file property. Select your database file and press F4, you can set properties there.

    Alternatively, you can check by debugging your code and see if it's saving data to db correctly without any exception.


    Thanks and Regards, Shailesh B. Davara

    Thursday, October 4, 2012 6:32 AM
  • When I debug my code there is no problem executing it, the data is stored in computer’s memory but don’t save permanently in data base and when I close the program I lost data. I think the reason is I didn’t set these two properties correctly for both data base file and data set file.

    Thursday, October 4, 2012 2:58 PM
  • you can check it with your database file which you are using. Because i guess it's overwritten when you again run application. Do you have App_Data folder with your data files there?

    Please check it.


    Thanks and Regards, Shailesh B. Davara

    Friday, October 5, 2012 5:20 AM
  •  

    No since it is a simple windows form application i don't have App_Data folder. I just added a local database file to my project.

    What do you mean by overwriting? How can I fix that.

    Thank you.

    Friday, October 5, 2012 8:19 AM
  • I set my database file (the .mdf file) properties like this:

    Build Action = Content

    Copy to output directory = Do not copy

    And set my dataset file properties like this:

    Build Action = None

    Copy to output directory = Do not copy

    And now I get an exception that says:

    “An attempt to attach an auto named database for file … failed. A database with the same name exist or specified filed cannot be opened or it’s located on UNC share.”

    When I change the copy to output directory property to copy always the data isn’t saved to database permanently and stay in computer’s memory until I close the application.

    Saturday, October 6, 2012 9:51 AM
  • Hi,

    Now your application can't able to find your db file. You can copy your data field directly to your debug folder. Now just check that when you run application you can able to access your database file.

    Open your folder location, go to debug folder and see if there is database file or not. If it's not there, please copy.


    Thanks and Regards, Shailesh B. Davara

    • Marked as answer by mortaza.mkr Saturday, October 13, 2012 4:25 PM
    Monday, October 8, 2012 4:12 AM
  • Thanks Shailesh B. Davara.

    after your helpful posts and reading this article I understanded what was happening.

    http://msdn.microsoft.com/en-us/library/ms246989(v=vs.100).aspx

    • Marked as answer by mortaza.mkr Saturday, October 13, 2012 4:25 PM
    Saturday, October 13, 2012 4:25 PM