且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何检查是否数据库使用ODBC存在

更新时间:2023-11-25 14:10:52

不知道这是不是太晚了,甚至足以为你便携式。

Don't know if this is too late, or even sufficiently "portable" for you.

我只需要处理与MS SQL,并且在使用选择的名字从一个master.dbo.sysdatabases中应用过去WHERE名称= @名称

I only have to deal with MS SQL, and in a past application used SELECT name FROM master.dbo.sysdatabases WHERE name = @name.

但是,在一个新的我使用ODBC的的SQLBrowseConnect (传递服务器名称和放大器;凭证),以获得在服务器的数据库列表。所以,我只是期待通过这些。我觉得原来的code表示来自 HTTP:// WWW。 codeproject.com / KB /数据库/ sqlsrvenumerator.aspx

But in a new one I am using the ODBC SQLBrowseConnect (passing in server name & credentials) to get a list of databases in the server. So I just look through those. I think the original code for that was from http://www.codeproject.com/KB/database/sqlsrvenumerator.aspx.

我没有ODBC专家,所以我不知道要在服务器(例如SQL浏览器服务)运行的需要或如何它的方法比较/实现。其实,我也不会介意别人的意见,以它是否有什么好的/更好!但它似乎是纯粹的ODBC的唯一!

I'm no ODBC expert, so I don't know what that requires to be running on the server (e.g. SQL Browser service) or how it compares in approach/is implemented. In fact, I wouldn't mind if anyone else comments as to whether it's any good/better! But it seems to be pure ODBC-only!