Can i use clickOnce to deploy MS Access database?

◇◆丶佛笑我妖孽 提交于 2019-12-12 06:19:10

问题


i have developed an application in a .mdb access file with tables linked to sql server

i try toput the mdb file in folder shared to all user but simultaneus access break the file very often.

so iam trying to deploy the .mdb file to every client machine and keep it update. i have created a winform app that check mdb file version and copy it to a local folder and next opens the local copy

but even in this way i have problem if too many user uses the winform launcher appat same time

so iam thinking if there is a bettere and simpler way:

can i use clickonce to deploy directly the access file and create a silly webform to launch it?

i have created the webform but how can i add the mdb file to deploy process? i have to add it to resources? and in that case embedded or not?

and in that case how clickonce detect that the access is a modified one?


回答1:


If I understand correctly, your .mdb file is the front end to a SQL Server back end. In that case, yes, each user should have their own copy of that FE. If you do a web search, there are many solutions for distributing an Access FE, without having to re-invent the wheel. A favorite is Tony's Auto FE Updater http://autofeupdater.com/.




回答2:


Found the solution finally: i add the db to Resources, setting build action to "Content", then my program.cs is this:

    static void Main()
    {
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        string nomeFile = @"\EW.accde";
        string DestinationPath;
        string codeBase = Assembly.GetExecutingAssembly().CodeBase;
        UriBuilder uri = new UriBuilder(codeBase);
        string path = Uri.UnescapeDataString(uri.Path);
        DestinationPath = System.IO.Path.GetDirectoryName(path) + @"\Resources";

        Process.Start(DestinationPath + nomeFile);
    }

in this way i simply copy the new db in project and then deply app with clickonce

once installed app simply launch the database file



来源:https://stackoverflow.com/questions/32069589/can-i-use-clickonce-to-deploy-ms-access-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!