Solved

Getting more meaningful error messages from COM (ADO)

Posted on 2002-03-14
7
1,374 Views
Last Modified: 2011-10-03
A number of applications I have use ADO, and it's great when everything works, but...

When you get an error like "OLE error 80030002" it can be hard to decipher what is going on.

There has to be a way of converting these meaningless hex error codes into something more insightful like "File not found".  (other than hardcoding each one)

Is there?

Look forward to your suggestions.

---
Note: In case there's not try comparing to the constants as specified in Windows.pas, such as ...

  { %l could not be found. }
  STG_E_FILENOTFOUND = HRESULT($80030002);
0
Comment
Question by:Hamlet081299
  • 4
  • 2
7 Comments
 
LVL 3

Expert Comment

by:Stefaan
Comment Utility
Hi,

Well, had this problem too a long time ago, apparently it seemed to be a bug in the Translation Resources at that time.  Setting my local settings to US English gave me the correct errors.

I'll look up what I exactly did, since i have written it down somewhere.

Further more there is a complete list on the Microsoft Website at the following URL :

http://support.microsoft.com/default.aspx?scid=kb;EN-US;q168354

Best regards,


Stefaan

0
 
LVL 26

Expert Comment

by:Russell Libby
Comment Utility

Hamlet,

Have you tried passing the OLE error code to the SysErrorMessage() function? It calls the FormatMessage API, which will return the system defined error message description for both win32 error codes as well as OLE HResults.

Russell
0
 
LVL 5

Author Comment

by:Hamlet081299
Comment Utility
Thanks for the suggestions so far...

The regional setting could be the issue.  Being in Australia, I like to have my dates around the "right" way, and also I like to be able to spell words like "colour" correctly.  ;-)

That list may come in handy too.

I will also look at SysErrorMessage.

I'll get back to you when I have had time to check these out (probably Monday).

Thanks again

H.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Author Comment

by:Hamlet081299
Comment Utility
As Stefaan has suggested, it must be something to do with being unable to find or access the actual messages.

I tried the same code on two different machines.  One gives the meaningless "OLE error 80030002" whilst the other gives "%1 not found" ... still not perfect, but definitely better.

Do you know where it is trying to find the messages?  Is it possible I am just missing a file, or that it is in the wrong place?
0
 
LVL 3

Accepted Solution

by:
Stefaan earned 100 total points
Comment Utility
Hi,

Well, can't remember completely what the issue was, but as far as I can remember it, it had something to do with the translation.  Setting the Regional Settings to US Englis solved the problem on my machine.

I will ask some colleagues of mine if they can remember what the actual problem was.

Best regards,


Stefaan
0
 
LVL 5

Author Comment

by:Hamlet081299
Comment Utility
I tried setting to US English, but it didn't help.  I suspect that one of the messaging dll's is missing or corrupted on this machine, or is for some reason not being loaded.  I just can't work out which one.
0
 
LVL 5

Author Comment

by:Hamlet081299
Comment Utility
I think it is just something missing on this machine.  The same code actually gives appropriate error messages on other machines.

I still have the problem, so if you have any insights as to what may be missing, I'd be glad to hear them.

In the meantime, you can have the points, as I have moved on and don't like to leave these questions sitting open.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now