Deadcats
asked on
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.Curso r.Current = System.Windows.Forms.Curso rs.WaitCur sor
oTable = System.Data.Sql.SqlDataSou rceEnumera tor.Instan ce.GetData Sources
For Each oRow As DataRow In oTable.Rows
If oRow("InstanceName").ToStr ing = "" Then
lbServers.Items.Add(oRow(" ServerName "))
Else
lbServers.Items.Add(oRow(" ServerName ").ToStrin g & "\" & oRow("InstanceName").ToStr ing)
End If
Next oRow
End If
End If
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.Curso
oTable = System.Data.Sql.SqlDataSou
For Each oRow As DataRow In oTable.Rows
If oRow("InstanceName").ToStr
lbServers.Items.Add(oRow("
Else
lbServers.Items.Add(oRow("
End If
Next oRow
End If
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
ASKER