Converting Microsoft Error Numbers into Something Useful

For whatever reason sometimes when I’m using OLEDB or ADODB error numbers are given as longs rather than as the more useful HEX numbers. More often than not these days when OLEDB or ADODB errors are thrown there’s no accompanying description so having the error number in a useful format is vital so I can work out what the heck the error actually is. The long format is not useful but the HEX format is because that’s the number Microsoft use in all their documentation. So how do you convert an error like this to something useful:

Error Number:-2147467259
Error Description:

Turns out it’s fairly simple. Just fire up the Windows calculator and put it into programmer mode, choose the Dec number format and enter the error code. It should look something like this:

Error in Decimal Format

Error in Decimal Format

Once you’ve done that convert the long to a HEX number and it should look like this:

Error in HEX Format

Error in HEX Format

The vital thing we see her is the last 8 digits. The error number is 80004005 which is then easily Googled. It turns out that it’s some sort of error establishing a connection to a database using OLEDB.

This entry was posted in Software on by .

About markn

Mark is the owner and founder of Timesheets MTS Software, an mISV that develops and markets employee timesheet and time clock software. He's also a mechanical engineer, father of four, and a lifelong lover of gadgets.