IErrorInfo.GetDescription failed with E_FAIL(0x80004005)


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

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.