Installshield如何将数据库包含到安装程序中并在安装期间将其附加到服务器 [英] Installshield how to include a database to a setup and attach it to a server during install

查看:266
本文介绍了Installshield如何将数据库包含到安装程序中并在安装期间将其附加到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用SQL Server 2014数据库的WPF应用程序。我想要使​​用InstallShield创建一个设置,让用户可以在他们的PC中安装而不需要做太多工作(只需点击一下,他们应该可以运行应用程序)。这是我第一次使用InstallShield。我一直在网上搜索教程,但大多数都不涉及数据库。以下是我的要求:

1.在我的设置中包含数据库(.mdf)或其脚本

2.在安装过程中,创建一个服务器(如果它不存在并附加)数据库创建/ .mdf到服务器并更新连接字符串。



我已经知道如何设置先决条件。



感谢您的帮助。



我尝试过:



我试图包含用于创建数据库的脚本并向SQL Server Express添加先决条件。每次我尝试安装应用程序时,我最终都会在屏幕上要求我选择服务器并输入用户名和密码。我输入sa而没有密码(如在installshield中设置)但它不会接受。

我完全不知道如何将数据库附加到服务器以及是否用于创建数据库的脚本是否已经运行。

I have a WPF app using SQL server 2014 database. I would want to create a setup using InstallShield that would let users install in their PCs without doing much(just some clicks and they should be able to run the app). It's my first time using InstallShield. I have been searching for tutorials online but most of them dont involve database. Here are my requirements:
1. Include a database (.mdf) or its script to my setup
2. During installation, create a server if it doesnt exist and attach the database created / .mdf to the server and update the connection strings.

I already know how to setup prerequisites.

Thank you for your help.

What I have tried:

I have tried to include scripts for database creation and adding prerequisites to SQL server Express. Every time I try to install the app I end up on a screen asking me to select the server and enter the username and password. I enter sa and nothing as password (as setup in installshield) but it wont accept.
And I completely have no idea on how it is gonna attach the database to the server and whether the script for database creation is already run or not.

推荐答案

之前提出过类似的问题,看看答案可能会有用:如何使用安装屏蔽为Sqlserver 2014设置make? [ ^ ]



由于我不使用Installshield而是使用免费的Inno安装程序安装程序,我无法帮助您使用Installshield,但可以说安装SQL Server是一个复杂的问题,有很多陷阱:



通常我先检查是否已经安装了SQL Server。

如果没有,请检查32位或64位版本是否必须安装。

使用正确的参数从临时目录运行SQL Server(Express)安装程序。

如果您想保持简单,可以使用Windows身份验证(没有用户名和密码问。)

安装你的应用程序并让它运行一个SQL脚本来创建数据库。

直接使用.mdf文件会遇到麻烦。



这是一个简单的Inno安装脚本:

Inno安装脚本,用于安装带有工具的SQL Server 2008 R2 [ ^ ]



我能提供的最好的建议是:不要使用SQL Server!

我厌倦了SQL Server的复杂性和膨胀的大小我决定使用 PostgreSQL (在C#中使用Npgsql)代替。



这是一个将SQL Server数据库转换为PostgreSQL的转换程序:

将SQL Server数据库转换为PostgreSQL [ ^ ]
A similar question was asked before, it might be useful to look at the answers: How do I setup make for Sqlserver 2014 with install shield?[^]

As I don't use Installshield but the free Inno Setup installer, I can't help you with Installshield, but can tell that installing SQL Server is a complex matter with lots of pitfalls:

Usually I check first if SQL Server is already installed.
If not, check if a 32 or 64 bits version must be installed.
Run the SQL Server (Express) installer from a temp directory with the correct parameters.
If you want to keep things simple, you can use Windows Authentication (no username and password asked).
Install your application and let it run an SQL script to create the database.
Working with .mdf files directly is asking for trouble.

Here is a simple Inno Setup script:
Inno Setup Script to Install SQL Server 2008 R2 with Tools[^]

The best advice I can offer however is: do not use SQL Server !
I got so fed up with the complications and bloated size of SQL Server that I decided to use PostgreSQL (with Npgsql in C#) instead.

Here is a conversion program to convert SQL Server databases to PostgreSQL:
Convert SQL Server Database to PostgreSQL[^]


这篇关于Installshield如何将数据库包含到安装程序中并在安装期间将其附加到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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