Check Instance existence with vb.net app

  • Thread starter Thread starter AbanoubZak
  • Start date Start date
A

AbanoubZak

Guest
Hello,

i'm trying to check if a specific instance is exist on the local machine with my app, let's say the Instance name need to check is "Instance1" how can i check for that?

i have a could which list the available server and instances

' Check if datatable is empty
If tableServers.Rows.Count = 0 Then

' Get a datatable with info about SQL Server 2000 and 2005 instances
tableServers = servers.GetDataSources()

' List that will be combobox’s datasource
Dim listServers As List(Of String) = New List(Of String)

' For each element in the datatable add a new element in the list
For Each rowServer As DataRow In tableServers.Rows

' SQL Server instance could have instace name or only server name,
' check this for show the name
If String.IsNullOrEmpty(rowServer("InstanceName").ToString()) Then
listServers.Add(rowServer("ServerName").ToString())
Else
listServers.Add(rowServer("ServerName") & "\" & rowServer("InstanceName"))
End If

Next

'Set servers list to combobox’s datasource
Me.cbb_instancias.DataSource = listServers
End If


but i need to check if "instance1" exist or not.

Continue reading...
 
Back
Top