golocorbin

golocorbin

  • NA
  • 44
  • 101.4k

view SQL instance NAME at LAN

Oct 1 2009 4:28 AM

I can't see all  SQL instance name at my LAN
I have 15 machines and four with SQL instance (and. NET 2.0 ,3.5 or 3.0 of course). When I run code
.........
 
public Form1()
{
InitializeComponent();
}
DataTable dataTable;
public void GetSQLInstances()
{
System.Data.Sql.SqlDataSourceEnumerator instance = System.Data.Sql.SqlDataSourceEnumerator.Instance;
 
dataTable = instance.GetDataSources();
if (dataTable.Rows.Count > 0)
{
InstancesInformation();
}
}
private void InstancesInformation()
{
 
foreach (System.Data.DataRow row in dataTable.Rows)
{
listBox1.Items.Add(row[0] + " " + row[1] +" "+ row[2] + " " + row[3]);
}
 
}
private void button1_Click(object sender, EventArgs e)
{
GetSQLInstances();
}
...........

i can see ONLY  sql instance NAME on machine where i run exe of this code and on the other three 'sql machine' i can see only name of machine( row[1],row[2] and row[3] is empty !!!).When i run this code on other 'SQL machine ' i see INSTANCE NAME of that machine but not  for other !?
why? 
 
 
  
 

Answers (2)