如何使用DataBase(mdf)部署项目。 [英] How Do I Deploy A Project With DataBase (mdf )in it.

查看:125
本文介绍了如何使用DataBase(mdf)部署项目。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含数据库的项目,

这是我的app.config代码。

I have a Project with Database in it,
This is my app.config's code.

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="QuanLyDoiBong"
            connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\QuanLyBongDa2.mdf;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>



我使用安装盾限制版部署项目,如果我将它安装在我的电脑上它完美运行,如果我把它带到另一台PC(没有SQL服务器),每当我按下一些需要连接数据库的按钮时我就会遇到这个例外:




I Deploy a project using install shield limited edition, if I install it on my PC it works perfectly, If I bring it to another PC (don't have SQL sever), whenever I press some button that need to connect to database I got this exception:

a network-related or instance-specific error occurred while establishing a connection to sql server, The sever was not found or was not accessible. Verify that the instance name is correct and that SQL sever is configured to allow remote connections. (Provider: SQL network intefaces, error 52 - Unable to locate a Local Database runtime installation. Verify that SQL sever Express is Properly installed and that the Local Database runtime feature is enabled





我认为我的订购PC(没有安装SQLsever)需要安装SQLSever,如果是这样,如何在没有安装SQL-sever的情况下在其他PC上运行此应用程序? />
和..英语不是我的母语,所以...抱歉我做的任何错误..

.

I think that my "Order PC (Which don't have SQLsever installed)" need to install SQLSever if so how can I run this application on Other PC without install SQL-sever ?
and .. English isn't my mother tongue language, so ... Sorry for any mistake I made..

推荐答案

1)In设置属性你会发现一个选项是先决条件从那里选择所有先决条件,如sqlserver和...

2)当你创建安装添加主输出和内容文件,将自动添加所有文件和从你的项目文件夹中它也有数据库



这些图片将帮助你了解更多..



使用Visual Studio安装项目为C#Windows应用程序创建一个MSI包 [ ^ ]





接受它,如果它为你工作
1) In setup properties you will find one opiton that is Prerequisite select all Prerequisite from there like sqlserver and ...
2)when you creating setup add primary output and "content file" that will automatically add all file and folder from your project it will have database also

These picture will help you to understand more..

Creating an MSI Package for C# Windows Application Using a Visual Studio Setup Project[^]


Accept it if its work for you


我的订购PC ......需要安装SQLSever



是的,如果你真的想使用LocalDB,否则不必在上安装SQL Server 系统,但系统需要能够与附带数据库的SQL Server的某些系统进行通信。如果此软件适用于其他人,则允许他们提供SQL Server实例(客户端可能已安装SQL Server),附加数据库,并根据需要编辑配置文件。
that my "Order PC ... need to install SQLSever

Yes, if you really want to use LocalDB, otherwise SQL Server doesn't have to be installed on that system, but the system needs to be able to communicate with some system that has SQL Server with the database attached. If this software is for someone else, then allow them to provide the SQL Server instance (a client may already have SQL Server installed), attach the database, and edit the config file as they need.


这篇关于如何使用DataBase(mdf)部署项目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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