getting the list of servers

  • I am designing an application that will provide for an interface to create tables and triggers and procedures etc.. When the user starts the application i want to show the list of sql servers that are there in the network. The only things i will have with me are the user name and the password. If i am able to connect to a specific server then i know that i can list out the servers from the sysserver table in the master database but my problem is how do i connect to the default server the user is authorized in without actually specifying the name of the server from the application? I am using C# to design the application. Any ideas anyone?

  • If you work with the DMO libraries, there is a ListSQLServers method call that will scan for those servers responding on 1434. this is sometimes blocked, especially after SQLSlammer, so it might not work.

    I'd guess in the SQL2005 SMO libraries there is something similar.

  • As a DOS command, you can use OSQL -L

    You could route that to a file using OSQL -L > somefilename

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Hi,

    With .Net 2, System.Data.Sql.SqlDataSourceEnumerator.GetDataSources() is what you need.

    With previous version of .Net, you can have a look at http://www.codeproject.com/cs/database/LocatingSql.asp

    Manu

  • Thank you all. I liked the SQLDMO option more. Once again a million thanks

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply