简体   繁体   English

如何在应用程序安装中部署数据库

[英]How to Deploy Database in Application Installtion

I have an application which uses Sql Server Express Edition to store data. 我有一个使用Sql Server Express Edition存储数据的应用程序。 I have a database with 8-10 tables in it. 我有一个带有8-10个表的数据库。 I have mdf and ldf file with me. 我有mdf和ldf文件。 Now i want to install my application in some other computer, then how to deploy my database with my installation files (assuming the other computer already have Sql Server with them). 现在,我想在其他计算机上安装我的应用程序,然后如何使用我的安装文件部署数据库(假设另一台计算机已经具有Sql Server)。 Can i use my mdf and ldf files, or i need to create my database and tables again programatically during installation of my Application. 我可以使用我的mdf和ldf文件,还是需要在安装应用程序时以编程方式再次创建数据库和表。

I am a newbie, please guide me. 我是新手,请引导我。 I am using .Net framework 4.0 and Visual Studio Professional Edition. 我正在使用.Net Framework 4.0和Visual Studio Professional Edition。

SQL Server Express runs out-of-process, so your application does not control the data files. SQL Server Express进程外运行,因此您的应用程序无法控制数据文件。 You have to submit your application data to SQL Server via data statements, replication, or whatever, and SQL Server gets to decide what to do with them. 您必须通过数据语句,复制或其他方式将应用程序数据提交到SQL Server,然后SQL Server可以决定如何处理它们。

You may be able to submit an .mdf directly to SQLS Express via an AttachDBFilename connection string, I have not tried this. 您可能可以通过AttachDBFilename连接字符串直接将.mdf提交到SQLS Express,但我没有尝试过。

If you used an embedded database like SQL Server Compact you would be able to include the data along with your application. 如果使用嵌入式数据库(如SQL Server Compact),则可以将数据与应用程序一起包括在内。 Whether this is a better solution depends on what else you are doing with your database. 这是否是更好的解决方案,取决于您对数据库所做的其他事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio 2010中使用SQL Server 2008数据库打包和部署ac#桌面应用程序? - How to package and deploy a c# desktop application with a sql server 2008 database in visual studio 2010? 如何将BizTalk应用程序部署到生产服务器中? - How to Deploy BizTalk Application into production Server? 如何使用MongoDB部署C#.net应用程序 - How to Deploy C# .net application with MongoDB 如何在企业内部网上部署我的Web应用程序 - How to deploy my web application on the intranet of entreprise 如何部署数据库项目? - How do I deploy a database project? 如何使用WebDeploy部署带有全文索引的数据库 - How to deploy a database with fulltext indexes with WebDeploy 如何使用应用程序安装数据库? - How to insall a database with an application? 如何在asp.net Web应用程序中部署项目 - how to deploy the project in asp.net web application 如何同时开发和部署应用程序的测试版本和生产版本 - How to develop and deploy both test and production version of the application at the same time 单击一次部署Cassini应用程序。 如何将Web应用程序复制到输出? - Deploy Cassini application with Click Once. How do I copy web application to output?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM