简体   繁体   English

SQL Server 2008 R2静默安装的连接字符串

[英]Connection string of SQL Server 2008 R2 silent install

I have a Windows application that works with a local database (SQL Server 2008 R2). 我有一个与本地数据库一起使用的Windows应用程序(SQL Server 2008 R2)。 I'm trying to create an install for my application. 我正在尝试为我的应用程序创建安装。

I want the installer check if SQL Server 2008 R2 is available in user system, installer doesn't install SQL Server and if there isn't any version of that the installer install a new version. 我希望安装程序检查用户系统中是否有SQL Server 2008 R2,安装程序未安装SQL Server,并且没有安装程序的任何版本,请安装新版本。

But my users can't install SQL Server, so I need to install it in silent mode 但是我的用户无法安装SQL Server,因此我需要以静默方式安装它

Now I create a setup project in VS2010 that install SQL Server in silent mode ... 现在,我在VS2010中创建一个安装项目,以静默方式安装SQL Server。

Two questions : 两个问题

  1. does the installer check for another version of SQL Server ? 安装程序是否检查其他版本的SQL Server? (I mean check if is available ...) (我的意思是检查是否可用...)

  2. what will be the connection string after installing SQL Server? 安装SQL Server之后的连接字符串是什么? (if it just install one time in each PC so I can have one unique connection string in all pc) (如果仅在每台PC上安装一次,那么我在所有PC上都可以有一个唯一的连接字符串)

  1. Yes you can check it by specifying a launch condition in your setup project Launch Condition: To create and manage launch conditions, you use the Launch Conditions editor in Visual Studio. 是的,您可以通过在安装项目中指定启动条件来检查它。 启动条件:要创建和管理启动条件,请使用Visual Studio中的启动条件编辑器。 You can access this tool by selecting your project in Visual Studio and then clicking the View menu. 您可以通过在Visual Studio中选择项目,然后单击“查看”菜单来访问此工具。 You will see an Editor submenu that contains several setup editors, including those for Registry, File System, File Types, User Interface, Custom Actions, and Launch Conditions 您将看到一个Editor子菜单,其中包含几个设置编辑器,包括注册表,文件系统,文件类型,用户界面,自定义操作和启动条件的编辑器
  2. You should set the connection string in your application as string connectionstring ="datasource = .; Initial Catalog = |DataDirectory|\\DBName.mdb;Integrated Security=SSPI I think this connection string will work. and if you are installing an sql sever express edition then 您应该在应用程序中将连接字符串设置为string connectionstring ="datasource = .; Initial Catalog = |DataDirectory|\\DBName.mdb;Integrated Security=SSPI我认为此连接字符串将起作用。如果您要安装sql sever express然后版

    string connectionstring ="datasource =.\\SQLExpress; Initial Catalog = |DataDirectory|\\DBName.mdb";Integrated Security=SSPI; 字符串connectionstring =“ datasource =。\\ SQLExpress;初始目录= | DataDirectory | \\ DBName.mdb”;集成安全性= SSPI;

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM