Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Identifying OLE DB errors

Identifying OLE DB errors

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelpquestionsql-servercom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    panzerdivisionmarkus
    wrote on last edited by
    #1

    Hi, Hope someone can help me with this. I want to identify a specific OLE DB error and display an error message that my users can understand. The way it is displayed right now is like this: Source:"Microsoft OLE DB Provider for SQL Server" Description:"Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)." hr = 0x80040e14 The hr should be equal to DB_E_ERRORSINCOMMAND, but this error code is used for other errors as well. How can I identify that it is the "Maximum stored procedure, function, trigger, or view nesting level exceeded (limit 32)" message that is displyed? I'd really like to change it to something that my users can understand. But I can't find anything to go on, please help me. I've included my error messaging function.

    void DisplayOLEDBErrorRecords(HRESULT hrErr) {
    	CDBErrorInfo ErrorInfo;
    	ULONG        cRecords;
    	HRESULT      hr;
    	ULONG        i;
    	CComBSTR     bstrDesc, bstrHelpFile, bstrSource;
    	GUID         guid;
    	DWORD        dwHelpContext;
    	WCHAR        wszGuid[40];
    	USES_CONVERSION;
    
    	LCID lcLocale = GetSystemDefaultLCID();
    
    	hr = ErrorInfo.GetErrorRecords(&cRecords);
    	if (FAILED(hr) && ErrorInfo.m_spErrorInfo == NULL) {
    		OLEDBErrorMessageBox( "No OLE DB Error Information found: hr = 0x%x\n", hr);
    		return;
    	}
    
    	for (i = 0; i < cRecords; i++) {
    		hr = ErrorInfo.GetAllErrorInfo(i, lcLocale, &bstrDesc, &bstrSource, &guid, &dwHelpContext, &bstrHelpFile);
    		if (FAILED(hr)) {
    			OLEDBErrorMessageBox("OLE DB Error Record dump retrieval failed: hr = 0x%x\n", hr);
    			return;
    		}
    
    		StringFromGUID2(guid, wszGuid, sizeof(wszGuid) / sizeof(WCHAR));
        
                    OLEDBErrorMessageBox( "Source:\"%s\"\nDescription:\"%s\"\nhr = 0x%x\n\n", OLE2T(bstrSource), OLE2T(bstrDesc), hrErr);
    
    		bstrSource.Empty();
    		bstrDesc.Empty();
    		bstrHelpFile.Empty();
    	}
    }
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups