简体   繁体   English

使用 UWP 应用程序检测和安装 SQL Server Express

[英]Detecting and installing SQL Server Express with UWP app

I have written an UWP app for managing employees, timesheets etc.我编写了一个 UWP 应用程序来管理员工、时间表等。

How do I detect if SQL Server Express is installed and if not installed how do I setup SQL Server Express on the client computer?如何检测是否安装了 SQL Server Express,如果未安装,如何在客户端计算机上设置 SQL Server Express? Is it possible to do it without running the exe file in 'fulltrust'?是否可以在不运行'fulltrust'中的exe文件的情况下做到这一点?

I would also like to include the setup files in my app package with the configuration file to run a silent install on the client computer.我还想在我的应用 package 中包含安装文件和配置文件,以便在客户端计算机上运行静默安装。

I have looked for a answer on many pages but could not find a real straight forward answer.我已经在很多页面上寻找答案,但找不到真正直接的答案。

Some help here would be much appreciated.这里的一些帮助将不胜感激。

when you have access to your client computer, you can run a check program in your setup process via checking if MS SQL Server Express registry key exists or not.当您可以访问您的客户端计算机时,您可以通过检查 MS SQL Server Express 注册表项是否存在来在设置过程中运行检查程序。 If it exists, then it is installed.如果存在,则安装它。

Read this doc from Microsoft, there is a code snippet in the doc you can use:从 Microsoft 阅读此文档,您可以使用文档中的代码片段:

https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2005/express-administrator/bb264562(v=sql.90)?redirectedfrom=MSDN https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2005/express-administrator/bb264562(v=sql.90)?redirectedfrom=MSDN

What do you mean by 'auto-detect' MS SQL Server Express installed'?您所说的“自动检测”MS SQL Server Express 安装是什么意思? Not sure what's your use case here.不确定您在这里的用例是什么。

Normally, you can not auto detect database to use since in many cases there could be multiple databases installed in the environment, and you don't know which one is the right one you are going to use.通常,您无法自动检测要使用的数据库,因为在许多情况下,环境中可能安装了多个数据库,而您不知道要使用哪一个是正确的。 You have to know which database you are going to use first.您必须知道首先要使用哪个数据库。

However, if you insist to detect database, you can do the port scan in your network which is really not a good idea.但是,如果您坚持检测数据库,您可以在您的网络中进行端口扫描,这确实不是一个好主意。

So guess maybe your use case is unique.所以猜猜你的用例可能是独一无二的。

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

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