private static void ProcessErrors(SqlErrorCollection errors) { if (errors == null) { return; } foreach (var error in errors.Cast <SqlError>()) { PrintMessage(string.Format(CultureInfo.CurrentCulture, "Sql Error: '{0}' (Severity {1}, State {2})", error.Message, error.Class, error.State)); } }
private static bool FindError(SqlErrorCollection errors, string error) { return(errors.Cast <SqlError>().ToList().Exists(x => x.ToString().ToLower().Contains(error))); }