![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
30/06/2008, 06:21
|
![Avatar de Indigo77](http://static.forosdelweb.com/customavatars/avatar205784_1.gif) | | | Fecha de Ingreso: diciembre-2007 Ubicación: España
Mensajes: 60
Antigüedad: 17 años, 2 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);
} |