Exceptions generated by SqlCommand.ExecuteReader()

Relevant documentation:
http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemdatasqlclientsqlcommandclassexecutereadertopic1.asp

SqlCommand.ExecuteReader throws by Exception and SqlException. Under what conditions does it through Exception instead of SqlException I don't think the documentation is correct; I'm pretty sure I've seen SqlExceptions raised in circumstances other than executing a command against a locked row.


Answer this question

Exceptions generated by SqlCommand.ExecuteReader()

  • Amate

    I don't have any examples; I am writing a database layer and am interested in what sort of non-SqlException exceptions might be thrown.

  • Sethu Srinivasan

    Could you paste some code which illustrates a situation where you got an Exception and NOT an SqlException while you expected an SqlException

    IMHO SqlDataReader throws an SqlException if the SqlServer throws an error.


  • Exceptions generated by SqlCommand.ExecuteReader()