private void ApplyNewConnectionSettings(ConnectionSettings connectionSettings) { try { college?.Dispose(); Connection connection = new Connection(connectionSettings.serverName, connectionSettings.dbName, connectionSettings.integratedSecurity, connectionSettings.login, connectionSettings.pass); connection.Open(); DataTable originalColumnsSchema = GetSchemaFromFile(COLUMNS_SCHEMA_FILENAME); DataTable columnsSchema = connection.SqlConnection.GetSchema("columns"); connection.Close(); if (!EqualsColumnsSchema(originalColumnsSchema, columnsSchema)) { MyMessageBox.ShowError(Resource1.WrongTable); return; } college = new College(connection); LoadGroupTypes(); SaveConnectionSettings(connectionSettings); } catch (SqlException) { MyMessageBox.ShowError("Настройки подключения неправильны. Настройте их в следующем окне."); ShowConnectionSettingsForm(false); } }