none
c# database access accdb does not work switching from debug to release RRS feed

  • Question

  • Hi guys!

    I wrote an application in c#..so..when i debug every think works well!

    But...whe i pack it using InstallShield or (other system packing) and put it on another computer i don't know why
    it does not save data into database.
    I put on the test machine the Runtime access..so where i'm wrong?
    Please help me! 
    My connection string: 
    InitializeComponent();

                con.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\BDIAI.accdb;Persist Security Info=False;";

    Friday, November 11, 2016 12:29 PM

All replies

  • write operation will fail when the target is read only. If your install your database to program files, that is going to happen.

    Put your database in the user's appdata folder. if it is shard, put it in the common app data folder, and grant permissions to everyone in your setup scripts.



    Visual C++ MVP

    Friday, November 11, 2016 3:38 PM
  • Could you show me how do it? I mean...how can i automatically set it inside the project?

    Thanks!

    Friday, November 11, 2016 6:09 PM
  • string fileName = Path.Combine(Environment.GetFolderPath(    Environment.SpecialFolder.ApplicationData), "datafile.accdb")

    //create the accdb file if it does not exist

    //open the accdb file



    Visual C++ MVP

    Friday, November 11, 2016 6:37 PM
  • Hi angelo7777,

    Please check if you install ACE provider in that machine, The ACE provider is not installed on Windows operating systems by default. You have to install it. The ACE provider is available in two forms: Microsoft Office Access database engine 2007 and the Microsoft Access Database Engine 2010 Redistributable

    For more information, please refer to:

    http://www.mikesdotnetting.com/article/280/solved-the-microsoft-ace-oledb-12-0-provider-is-not-registered-on-the-local-machine 

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, November 12, 2016 5:12 AM
    Moderator
  • https://www.dropbox.com/sh/r6uqh16zbqv674c/AABwoANP8vRrREdPG2Homn8va?dl=0

    Man... i tried but nothing change!

    If you have time could you have a look to the project? I give you the link to download it.

    In case you check..thanks a lot!

    Saturday, November 12, 2016 1:39 PM
  • https://www.dropbox.com/sh/r6uqh16zbqv674c/AABwoANP8vRrREdPG2Homn8va?dl=0

    I Man!

    I thought it  and i installed it too but no way...still not working.

    I fyou want have a look the project for me will be great!

    Thenks!

    Saturday, November 12, 2016 1:41 PM
  • Hi angelo7777,

    I could not download your project from the URL directly, could you please upload the project via OneDrive, we'll reproduce your issue on our side and try to find a solution to resolve it.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 14, 2016 1:11 AM
    Moderator
  • For an Access database I prefer to use a Documents subfolder (Environment.SpecialFolder.MyDocuments) for the app since you can encounter security issues with Program Files and other folders.

    Also, your app should have Try...Catch exception handling so errors can be displayed or logged. If you are using TableAdapters, which were created in the Data Designer, make sure to change the data source.


    Paul ~~~~ Microsoft MVP (Visual Basic)

    Monday, November 14, 2016 3:25 PM
  • ok! Let me upload the project on onedrive ..tommorrow i leto you know the link..thanks!
    Monday, November 14, 2016 3:35 PM
  • So did you find the problem?.....
    Wednesday, November 16, 2016 9:57 AM
  • Are you alive?
    Thursday, November 17, 2016 4:16 PM
  • Hi angelo7777,

    I have download the project, and it works well on side. As Paul suggest, you could display error message on Catch exception, and you could find further clue.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 21, 2016 8:34 AM
    Moderator
  • Hi Man! I told you it workS!  The problerm is when you pack it! I already tried to look for errors (try catch) but...there are not errors!! This is the reason i'm asked help...

    Try to pack it!!

    Thanks!

    Monday, November 21, 2016 9:31 AM
  • Hi angelo7777,

    I have check the database, because you add a record on bin/debug/ folder/BDIAI.accdb, which cause the issue. on debug mode, please right click project - >  clean and build again, it will same with release mode.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 22, 2016 1:13 AM
    Moderator
  • Hi Cole! So i tried what you told me..cleaning up before packing...no way!

    The release made by InstallShield still not working.

    Really i don't know ...thanks anyway for your help!

    Wednesday, November 23, 2016 7:28 PM
  • Hi angelo7777,

    Please add some data in access database by manually and check if it shows on you UI.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, November 25, 2016 1:01 AM
    Moderator
  • So Man i must be idiot! Really no way!! Did you try to pack it? Is it work by you?!
    Friday, November 25, 2016 3:58 PM
  • Hi angelo7777,

    Please open BDIAI.accdb in your release folder and add a record like this:

     

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 28, 2016 8:25 AM
    Moderator
  • i did it man!  but nothing change when i pack it...the problem still exist
    Monday, November 28, 2016 8:54 AM
  • Hi angelo7777,

    Please check if the access database has records after you install it.

    Best regards,

    Cole Wu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 30, 2016 3:24 AM
    Moderator
  • So Man...

    after installing the program i can not see the database because it seems just in reading modality

    (access Runtime 2016)

    anyway using the program nothing appeare inside...so what to do?

    Friday, December 2, 2016 10:22 AM