Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/06/2008, 06:21
Avatar de Indigo77
Indigo77
 
Fecha de Ingreso: diciembre-2007
Ubicación: España
Mensajes: 60
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Sentencia web para concoer servidores instalados

Hola,

creo que esté código te valdrá

public Form1()
{
InitializeComponent();

// Retrieve the enumerator instance and then the data.
SqlDataSourceEnumerator instance =
SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();

// Display the contents of the table.
Display(table);
}

private void Display(System.Data.DataTable table)
{
string message = string.Empty;
foreach (System.Data.DataRow row in table.Rows)
{
if (row["InstanceName"].ToString() != string.Empty)
message += string.Format(@"{0}\{1}", row["ServerName"], row["InstanceName"])+ System.Environment.NewLine;
else
message += string.Format(@"{0}", row["ServerName"]) + System.Environment.NewLine;
}

MessageBox.Show(message);
}