简体   繁体   English

使用其他软件的数据库为偶尔连接的应用程序创建自定义安装程序

[英]Creating a custom installer for occasionally connected application using database of another software

I am trying to create an application which will synchronize its database with another software's database.. 我正在尝试创建一个应用程序,它将其数据库与另一个软件的数据库同步。

Problems are: 问题是:

  1. How will the database will synchronize with external database after I have created the installer and installed..ie how will it take the connection string. 创建安装程序并安装后,数据库将如何与外部数据库同步。即如何获取连接字符串。

    I am looking for a solution which will provide a button to select the required database and based on the selection automatically generate the connection string. 我正在寻找一种解决方案,该解决方案将提供一个按钮来选择所需的数据库,并根据选择自动生成连接字符串。

  2. Is it possible to run SQL create queries on external database while installation after the database is selected via browse button? 通过浏览按钮选择数据库后,是否可以在安装时在外部数据库上运行SQL创建查询?

  1. You have an option to create a Connection Settings form, which will help user to construct the connection string. 您可以选择创建一个“连接设置”表单,该表单将帮助用户构造连接字符串。

  2. Yes, it's possible. 是的,有可能。 It looks something like this: 看起来像这样:

     using (var sqlConnection = new SqlConnection(@"Data Source=myServerAddress;User Id=myUsername;Password=myPassword;")) { sqlConnection.Open(); string query = "CREATE DATABASE..."; using (var sqlCommand = new SqlCommand()) { sqlCommand.Connection = sqlConnection; sqlCommand.CommandText = query; sqlCommand.ExecuteNonQuery(); } } 

If it won't work, try to set Initial Catalog to master: 如果它不起作用,请尝试将“初始目录”设置为master:

@"Data Source=myServerAddress;Initial Catalog=master;User Id=myUsername;Password=myPassword;"

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

相关问题 为Windows Mobile偶然连接的应用程序创建cab文件 - Creating cab file for Windows Mobile Occasionally Connected Application 创建软件安装程序 - Creating a Software Installer VS在应用程序中使用SQL Server数据库创建安装程序 - VS Creating Installer with SQL Server database in application 构建OCA的工具(偶尔连接的应用程序) - Tools for Building an OCA (Occasionally Connected Application) 为C#应用程序创建安装程序时要使用的数据库 - Database to use when creating an installer for your c# application 在哪里可以找到显示NET中偶尔连接的应用程序的示例? - Where can i find a sample showing an Occasionally Connected Application in NET? 在MSI安装程序中使用C#创建自定义对话框 - Creating custom dialog using C# in MSI installer 偶尔连接的应用程序-SQL Compact + EntityFramework + SyncFramework问题 - Occasionally connected application - SQL Compact+EntityFramework+SyncFramework issue 使用Visual Studio为数据库安装程序创建升级补丁 - Creating upgrade patch for database installer using visual studio 需要使用自定义安装程序类检查已安装的应用程序 - need to check already application installed or not using custom installer class
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM