void SelectServerName() { try { txtServerName.Items.Clear(); SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; DataTable table = instance.GetDataSources(); foreach (DataRow row in table.Rows) { SqlServerList sqlSl = new SqlServerList { ServerName = row[0].ToString(), InstanceName = row[1].ToString() }; string sqlName; if (string.IsNullOrEmpty(sqlSl.InstanceName)) { sqlName = sqlSl.ServerName; } else { sqlName = sqlSl.ServerName + "\\" + sqlSl.InstanceName; } txtServerName.Items.Add(sqlName); } } catch { } }
public object Clone() { try { if (this == null) { return(null); } SqlServerList SqlSL = new SqlServerList { ServerName = ServerName, InstanceName = InstanceName, IsClustered = IsClustered, Version = Version }; return(SqlSL); } catch { throw new NotImplementedException(); } }
public object Clone() { try { if (this == null) { return null; } SqlServerList SqlSL = new SqlServerList { ServerName = ServerName, InstanceName = InstanceName, IsClustered = IsClustered, Version = Version }; return SqlSL; } catch { throw new NotImplementedException(); } }
void SelectServerName() { try { txtServerName.Items.Clear(); SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; DataTable table = instance.GetDataSources(); foreach (DataRow row in table.Rows) { SqlServerList sqlSl = new SqlServerList { ServerName = row[0].ToString(), InstanceName = row[1].ToString() }; string sqlName; if (string.IsNullOrEmpty(sqlSl.InstanceName)) sqlName = sqlSl.ServerName; else sqlName = sqlSl.ServerName + "\\" + sqlSl.InstanceName; txtServerName.Items.Add(sqlName); } } catch { } }