Brandon Moore
Brandon Moore

Reputation: 8790

Fastest way to enumerate Sql Servers

I'm aware of how to enumerate sql servers using the SqlDataSourceEnumerator and also how to do it using SMO objects. Both of these ways are slow. Are these pretty much the only options or are there any other ways to do it that might be a little faster?

Thanks!

Upvotes: 0

Views: 300

Answers (1)

competent_tech
competent_tech

Reputation: 44971

I have never noticed a significant speed difference or discovered a way to make either one faster.

However, if you are distributing your applications to end users or running it on server machines, then I would suggest using SqlDataSourceEnumerator so that you don't have to hassle with SMO being registered on the machines or version compatibility with SMO.

In addition, if you are presenting the list to users to select from, you could improve the user experience by providing the values in an editable combobox where they could enter the name of the server if they know it and as soon as you have finished collecting the list of available servers, you could populate the dropdown.

I haven't looked at the SMO objects in awhile, but if they support events that report back as servers are discovered, this could improve the performance even more since you could add items to the dropdown as they are reported by SMO. However, it is just speculation on my part at this point that this behavior would be supported.

Upvotes: 1

Related Questions