• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

Enumerating SQL Server and SQL Express

Hello All

I have written an application in VB.Net 2010 that requires Sql Server. I have also created an install program that will install SQL Server Express 2008 if it does not find SQL Server. This all works in regards to installing SQL Express if it is needed and SQL Express shows up in my running process. The problem I am having is that I have a routine that will enumerate the servers that are available to this computer but it will not list the SQL Server Express that I just installed. This computer is not connected to a network so it does not know about the instances that are installed on my network. If I connect it to the network it finds the network SQL Servers but not the local one. Can anyone tell me what I'm doing wrong. I have tried this on both Vista and Windows 7 and I have formatted the machine so I know everything is clean. I have included the code that I am using to enumerate the servers below.

Thanks in Advance DC

DC

If lbServers.Items.Count = 0 Then
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
                oTable = System.Data.Sql.SqlDataSourceEnumerator.Instance.GetDataSources

                For Each oRow As DataRow In oTable.Rows
                    If oRow("InstanceName").ToString = "" Then
                        lbServers.Items.Add(oRow("ServerName"))
                    Else
                        lbServers.Items.Add(oRow("ServerName").ToString & "\" & oRow("InstanceName").ToString)
                    End If
                Next oRow
            End If
End If
0
Deadcats
Asked:
Deadcats
  • 2
1 Solution
 
regevhaCommented:
By default the SQL Express "SQL Server Browser" windows service is disabled. If you enable it, your code will be able to find it as well.
0
 
DeadcatsAuthor Commented:
Thanks that took care of it.
0
 
DeadcatsAuthor Commented:
Thanks
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now