No Default SQL Instance on Install?

Problem: When the application installs it requires SQL Express Server 2005. If it does not exist it will install it or rollback. -> continue installation -> When the form attempts to locate an SQL Instance on a machine that has not had SQL server or any components connected before it shows up as <null>. I need to have access to the server(s) instances in order to build the application database inside SQL. Am I using the wrong approach with SQLDMO Is there adifferent method to access the installed SQL Express 2005 connection string

Current code to locate SQL Instances:

try
{
////////////////////////////////////////
// Search and List SQL Server Instances
////////////////////////////////////////

//set cursor to thinking/hourglass
System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.AppStarting;

//begin
ArrayList aServers = new ArrayList();
SQLDMO.ApplicationClass acServers = new SQLDMO.ApplicationClass();
//loop through the servers found
for (int iServerGroupCount = 1; iServerGroupCount <= acServers.ServerGroups.Count; iServerGroupCount++)
{
for (int iServerCount = 1; iServerCount <= acServers.ServerGroups.Item(iServerGroupCount).RegisteredServers.Count; iServerCount++)
{
aServers.Add(acServers.ServerGroups.Item(iServerGroupCount).RegisteredServers.Item(iServerCount).Name);
}
}
//add the servers to the drop down box
if (aServers.Count < 1)
{
string NotExist = "<No Servers Found>";
cboServers.Items.Add(NotExist);

cboServers.SelectedIndex = 0;
btnSQLDataBaseCheckDB.Enabled = false;

}
else
{
cboServers.Items.AddRange(aServers.ToArray());
//select the first item in the array index to display
cboServers.SelectedIndex = 0;
}
}
catch (Exception ServerException)
{
MessageBox.Show(ServerException.Message);
}


Slightly stuck at the moment with this. Any tips or leads in the right direction would be greatly appreciated.


Answer this question

No Default SQL Instance on Install?

  • Jster

    sorry to double post. Found a relative link in the forums which may add some more insight to the problem, though certainly not solve it.

    http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=385579&SiteID=1&mode=1

  • No Default SQL Instance on Install?