IErrorInfo.GetDescription failed with E_FAIL(0x80004005)

Posted: 12/04/2006

Yup, that's the error:

IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).

This is a classic example of a terrible error message... what it should say is: You used a keyword reserved by <insert component>. My SQL Statement worked fine when run straight against the database but through the OLEDB provider threw the above message. I happened to be using the reserved word 'Section' in my statement... once I changed the name the data reader execution proceeded fine... I commonly use the word 'Section' because I write SQL queries that section off parts of the result set so that reporting applications like Crystal Reports have a much easier time handling the output... greatly cuts down on the time spent actually building of the report. Below is my before and after SQL:

Incorrect due to reserved word:

    Select 'response1' As Section, Count(*) as myCounter from pollResponses WHERE answer='response1'
    Union
    Select 'response2' As Section, Count(*) as myCounter from pollResponses WHERE answer='response2'
    Union
    Select 'response3' As Section, Count(*) as myCounter from pollResponses WHERE answer='response3'
    Union
    Select 'response4' As Section, Count(*) as myCounter from pollResponses WHERE answer='response4'
    Union
    Select 'total' As Section, Count(*) as myCounter from pollResponses

Corrected SQL:

    Select 'response1' As Answer, Count(*) as myCounter from pollResponses WHERE answer='response1'
    Union
    Select 'response2' As Answer, Count(*) as myCounter from pollResponses WHERE answer='response2'
    Union
    Select 'response3' As Answer, Count(*) as myCounter from pollResponses WHERE answer='response3'
    Union
    Select 'response4' As Answer, Count(*) as myCounter from pollResponses WHERE answer='response4'
    Union
    Select 'total' As Answer, Count(*) as myCounter from pollResponses