安装软件 [英] Installation of a software

查看:104
本文介绍了安装软件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用C#.Net Framework 3.5创建Windows窗体应用程序.我的应用程序正在使用SQL SERVER 2005数据库.我的客户在他的计算机上安装了SQL Server.我如何也可以安装数据库?是否必须使用SQL SERVER CONFIGURATION MANAGER做一些事情?是否可以使用我的软件安装文件直接安装数据库?请有人帮帮我!!

Hi
I am having a Windows form application created using C# .Net Framework 3.5. My application is using a SQL SERVER 2005 database. My customer has got the SQL Server installed in his machine. How can I get the database installed too? Do have to do some thing using SQL SERVER CONFIGURATION MANAGER? Is it possible to install the database directly using my software setup file? Please someone help me out!!!

推荐答案

您不能安装数据库,但是可以备份数据库并还原另一台计算机上的数据库.看看这个讨论:
http://stackoverflow.com/questions/8715687/如何从一台计算机复制到另一个数据库 [
You can''t install a database, but you can back up the database and restore the database on another computer. Have a look at this discussion:
http://stackoverflow.com/questions/8715687/how-to-copy-a-database-from-one-computer-to-another[^]


您需要创建一个设置来创建/与应用程序安装一起部署数据库.

看看这些:
创建设置并支持使用VS.NET创建数据库 [在安装.NET应用程序期间创建数据库 [部署您的应用程序和数据库 [
You would need to create a setup that creates/deploy database along with your application install.

Have a look at these:
Creating setup With support for database creation Using VS.NET[^]
Create database during installation of a .NET application [^]
Deploy your Application and Database[^]


在创建安装程序时添加数据库bak文件或脚本文件. br/>
现在,
当应用程序启动时与sql master数据库连接
火灾查询,检查数据库是否存在
如果没有,

1.如果您在安装程序中添加了.bak文件,
然后首先执行查询以创建数据库,然后从.net执行恢复数据库查询,然后重新创建与数据库的连接(保留主数据库连接)

2.如果您添加了脚本,则使用相同的方法
然后首先执行查询以创建数据库,然后读取脚本文件并在cmd.commandtext中进行分配,然后执行该命令

祝您编码愉快!
:)
when you are create setup add database bak file or script file.

now,
when application start connect with sql master database
fire query that checks whether database exist or not
if not then,

1. if you have added .bak file in setup,
then first execute query for create database and then execute restore database query from .net, then re-create connection to your database(leave master database connection)

2. if you added script then same way
then first execute query for create database and then read script file and assign in cmd.commandtext then execute that command

Happy Coding!
:)


这篇关于安装软件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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