Cách 1
Điều hướng loại lỗi , và câu lỗi trả về 

try
            {
                SqlDataReader rs = cmd.ExecuteReader();
            }
            catch (InvalidCastException exception)
            {
                Debug.WriteLine(exception.Message)
            }
            catch (SqlException exception)
            {
                Debug.WriteLine(exception.Message)
            }
            catch (InvalidOperationException exception) // This handles ObjectDisposedException
            {
                Debug.WriteLine(exception.Message)
            }
            catch (IOException exception)
            {
                Debug.WriteLine(exception.Message)
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message)
            }


Cách 2
Điều hướng loại lỗi , và câu lỗi trả về 

-------------------------- -------------------------------------------------
class Student
{
    public int StudentID { get; set; }
    public string StudentName { get; set; }
}

[Serializable]
class InvalidStudentNameException : Exception
{
    public InvalidStudentNameException() {  }

    public InvalidStudentNameException(string name)
        : base(String.Format("Invalid Student Name: {0}", name))
    {

    }
}

-------------------------- -------------------------------------------------

class Program
{
    static void Main(string[] args)
    {
        Student newStudent = null;
          
        try
        {               
            newStudent = new Student();
            newStudent.StudentName = "James007";
            
            ValidateStudent(newStudent);
        }
        catch(InvalidStudentNameException ex)
        {
            Console.WriteLine(ex.Message );
        }
          

        Console.ReadKey();
    }

    private static void ValidateStudent(Student std)
    {
        Regex regex = new Regex("^[a-zA-Z]+$");

        if (!regex.IsMatch(std.StudentName))
             throw new InvalidStudentNameException(std.StudentName);
            
    }
}

-------------------------- -------------------------------------------------