Click here to Skip to main content
15,902,112 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear friend,

I am having the following function to find a SQLServer instance. It works fine on local computer. Would you please tell me how to use this function to check an Instance on other computer on a Local Area Network? I am using VS2008 (framework 3.5) and SQL Server Express 2005.

Private Function MyInstanceFound(ByVal MyInstanceName As String) As Boolean
       Dim InstanceFound As Boolean = False
       Dim MC As ManagedComputer = New ManagedComputer()
       For Each SI As ServerInstance In MC.ServerInstances
           If SI.Name.ToString = MyInstanceName Then
               InstanceFound = True
               Exit For
           End If
       Next
       Return InstanceFound
   End Function


Thanking you in advance.

Regards,
SKPaul
Posted
Updated 7-Aug-11 20:25pm
v2

1 solution

 
Share this answer
 
v2
Comments
Saumitra Kumar Paul 8-Aug-11 1:58am    
Dear Patel,
Thank you for your suggestion. That is quite helpful. But I want to check the instance on an specific LAN IP.

Regards,
SKPaul
Prerak Patel 8-Aug-11 2:35am    
Then why don't you use New ManagedComputer(machineName)?!
Saumitra Kumar Paul 10-Aug-11 1:41am    
Thanks,
I'll try it. But for the time being, it seems to work.

SKPaul

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900