如何使用SQL .mdf数据库部署Windows应用程序? [英] How to deploy a windows application with SQL .mdf database?

查看:86
本文介绍了如何使用SQL .mdf数据库部署Windows应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序没有运行,当我尝试在安装后在另一台PC上运行它显示一条消息 - 对象未设置为对象的实例。

My application is not running, when i try to run on another pc after installation it shows a message- "object is not set to instance of an object".

推荐答案

您的mdf文件应该在共享计算机上运行,​​而不是部署,因为它在您在同一数据库中更新的数据库系统的中心,或者您的更新彼此不可见。因此,将数据库移动到网络位置。然后从您部署的位置访问这些位置并更新数据库连接。

1.分离,文件复制,附加:要完成的MSDN步骤 [ ^ ]

2.配置为允许外部连接

http://blogs.msdn.com/b/walzenbach/archive/2010/04 /14/how-to-enable-remote-connections-in-sql-server-2008.aspx [允许远程连接]

3.更新sql连接字符串

在MS Visual Studio中添加与Server Explorer窗格的连接,然后右键单击它并选择属性(f4) d找到连接字符串。将其复制到您拥有的地方。
Your mdf file should run on a shared machine, not be deployed as it is central in the database system that you are updating in the same database or your updates wouldn't be visible to each other. So move the database to a network location. then make that locations reachable from the places you deploy and update your database connection.
1. Detach, filecopy, attach: MSDN steps to complete[^]
2. configure to allow external connections
http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx[Allowing remote connections]
3. update sql connection string
Add a connection to Server Explorer pane in MS Visual Studio, then rightclick on it and select properties (f4) you should find the connection string. Copy that to where you had one.


这篇关于如何使用SQL .mdf数据库部署Windows应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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