我可以使用clickOnce部署MS Access数据库吗? [英] Can i use clickOnce to deploy MS Access database?

查看:108
本文介绍了我可以使用clickOnce部署MS Access数据库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在.mdb访问文件中开发了一个应用程序,该文件具有链接到sql server的表

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

我尝试将mdb文件放入所有用户共享的文件夹中,但同时访问却经常破坏该文件.

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

所以我试图将.mdb文件部署到每台客户端计算机上并保持更新.我创建了一个Winform应用程序,该应用程序检查mdb文件版本并将其复制到本地文件夹,然后打开本地副本

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

但是即使这样,如果太多用户同时使用winform启动器应用程序,我还是会遇到问题

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:

我可以使用clickonce直接部署访问文件并创建一个愚蠢的Webform来启动它吗?

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

我已经创建了Webform,但是如何添加mdb文件来部署流程?我必须将其添加到资源?在那种情况下是否嵌入?

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?

那么在这种情况下clickonce如何检测到该访问已被修改?

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

推荐答案

终于找到了解决方案: 我将数据库添加到资源中,将构建操作设置为内容",然后我的program.cs是这样的:

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);
    }

这样,我只需在项目中复制新数据库,然后单击clickonce即可应用

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

这篇关于我可以使用clickOnce部署MS Access数据库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆