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:
Once you’ve done that convert the long to a HEX number and it should look like this:
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.