C# IsODBCServerAvailable
我想实现一个“smartODBCLogin”。 我知道如何从注册表中的所有 ODBC 数据源获取所有引擎名称和驱动程序的列表。
现在我想知道哪些来源可用(活跃)。 (打开一个新的 odbcConnection 不起作用/没有帮助,会花费很多时间。)
有人知道如何在 c# 中实现这个吗?
I want to implement a "smartODBCLogin".
I know how to get a list of all engineNames and drivers from all ODBC data sources out of the registry.
Now I want to know, which of these sources are available (active).
(To open a new odbcConnection wouldn't work/help, would take to much time.)
Does anybody know how to implement this in c#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,没有 .NET API 可以实现此目的,但有一个本机 ODBC API 可以实现此目的,在 Microsoft 网站上有详细信息。还有一个很好的 代码示例此处列出的用户和系统 DSN 可能会对您有所帮助。 CodeProject 上还有一个代码示例,看起来它获取了驱动程序列表 。
如果您很着急,这里是第一篇文章示例(用于获取用户和系统 DSN),其中包含所有抄袭的荣耀:
获取系统 DSN:
获取用户 DSN:
获取所有 DSN:
将它们绑定到组合框:
完整的源代码可在上面的链接中找到。
There is no .NET API for this (that I know of), but there is a native ODBC API for this, detailed on the Microsoft site here. There is also a nice code sample that might help you over here that lists User and System DSNs. There is also a code sample at CodeProject that looks like it gets the driver list.
If you're in a hurry, here is the first article samples (to get user and system DSNs) in all their plagiarized glory:
Get system DSNs:
Get User DSN's:
Get all DSN's:
Bind them to a combo box:
Full source code is available at the link, above.