在 Inno-setup 项目中查询 SQL Server
我正在使用 Inno-setup 创建一个设置。
在设置过程中,必须创建 SQL Server 数据库。我想让用户能够选择现有的 SQL Server 实例(如果存在),必须在其中创建数据库。
因此,我在设置中想要做的是查询网络(和本地计算机)中的 SQL Server 实例。
此外,当用户选择一个实例时,我想验证是否存在该实例上具有特定名称的数据库。
有人知道我该怎么做吗?或者也许有人可以给我一些好的方向指示?
I'm creating a setup using Inno-setup.
During the setup process, a SQL Server database has to be created. I want to give the user the ability to select an existing SQL Server instance (if one exists), where the database has to be created.
So, what I want to do in the setup, is to query the network (and the local machine) for SQL Server instances.
Furthermore, when the user has selected an instance, I want to verify if there exists a database on that instance which has a specific name.
Anybody who knows how I can do this ? Or maybe someone could give me some pointers in the good direction?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Inno Setup 支持调用外部 DLL 函数,因此您应该编写一个合适的辅助 DLL。托管 .net DLL 只能通过 COM 接口使用,否则您需要非托管 DLL。
Inno Setup supports the call of external DLL functions, so you should write a suitable helper DLL. Managed .net DLLs can only be used via a COM interface, otherwise you need an unmanaged DLL.
尝试以下本机 .Net 库调用:
生成的数据表包含以下列:
ServerName
服务器的名称。
InstanceName
服务器实例的名称。如果服务器作为默认实例运行,则为空。
IsClustered
指示服务器是否属于集群的一部分。
版本
服务器的版本(对于 SQL Server 2000 为 8.00.x,对于 SQL Server 2005 为 9.00.x)。
Try the following native .Net library call:
The resultant datatable contains the following columns:
ServerName
Name of the server.
InstanceName
Name of the server instance. Blank if the server is running as the default instance.
IsClustered
Indicates whether the server is part of a cluster.
Version
Version of the server (8.00.x for SQL Server 2000, and 9.00.x for SQL Server 2005).