December 28, 2005 at 3:51 pm
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?
December 28, 2005 at 4:21 pm
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.
December 28, 2005 at 8:11 pm
As a DOS command, you can use OSQL -L
You could route that to a file using OSQL -L > somefilename
--Jeff Moden
Change is inevitable... Change for the better is not.
December 29, 2005 at 1:57 am
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
December 29, 2005 at 6:20 am
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