public static List <SqlDatabaseSettings> GetSQLDatabasesSettings(string pDatabaseServerName, string pDatabaseLoginName, string pDatabasePassword, bool pintegrated) { SqlConnection connection = ConnectionManager.GeneralSqlConnection; try { connection.Open(); SQLInfoEnumerator sie = new SQLInfoEnumerator { SQLServer = pDatabaseServerName, Username = pDatabaseLoginName, Password = pDatabasePassword, IntegratedSecurity = pintegrated }; List <SqlDatabaseSettings> list = new List <SqlDatabaseSettings>(); foreach (string database in sie.EnumerateSQLServersDatabases()) { SqlDatabaseSettings sqlDatabase = _GetDatabaseInfos(database, connection); if (sqlDatabase == null) { continue; } list.Add(sqlDatabase); } connection.Close(); return(list); } catch (Exception ex) { connection.Close(); throw ex; } }
public static List<SqlDatabaseSettings> GetSQLDatabasesSettings(string pDatabaseServerName, string pDatabaseLoginName, string pDatabasePassword, bool pintegrated) { SqlConnection connection = ConnectionManager.GeneralSqlConnection; try { connection.Open(); SQLInfoEnumerator sie = new SQLInfoEnumerator { SQLServer = pDatabaseServerName, Username = pDatabaseLoginName, Password = pDatabasePassword, IntegratedSecurity = pintegrated }; List<SqlDatabaseSettings> list = new List<SqlDatabaseSettings>(); foreach (string database in sie.EnumerateSQLServersDatabases()) { SqlDatabaseSettings sqlDatabase = _GetDatabaseInfos(database, connection); if (sqlDatabase == null) continue; list.Add(sqlDatabase); } connection.Close(); return list; } catch (Exception ex) { connection.Close(); throw ex; } }