FIX: Specific Error Messages Not Returned by ADO/WFC

Article translations Article translations
Article ID: 291014 - View products that this article applies to.
This article was previously published under Q291014
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SYMPTOMS

When using the ActiveX Data Objects for Windows Foundation Classes (ADO/WFC) to access a database, specific error codes are not returned when exceptions are thrown. With ADO 2.5 and 2.6, all errors are returned as the following:
Unknown error(0x800a0cb3)
The exact error code may differ, depending on the cause of the particular problem.

CAUSE

The IErrorInfo interface is not correctly exposed in ADO 2.5 and ADO 2.6. As a result, the WFC classes are unable to get details of the exception, causing WFC to report a more generic error.

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack

Hotfix

The English version of this fix should have the following file attributes or later:
   Date      Time    Version      Size           File name
   -------------------------------------------------------------
   02/20/01  20:53   2.61.7219.0  528,656 bytes  Msado15.dll
   04/11/01                       304,128 bytes  Q291014_MDAC26_SP1_x86_en.exe
				
NOTE: This fix should only be applied to computers currently running Microsoft Data Access Components (MDAC) version 2.6. At this time, a fix is not available for MDAC 2.5 computers.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 1.

MORE INFORMATION

Steps to Reproduce Behavior

The following Visual J++ code can be used to illustrate the problem:
import com.ms.wfc.data.*;
import com.ms.com.*;

public class Class1
{
   public static void main (String[] args)
   {
	   try
	   {
		Connection cnConn1 = null;
		String strCnn = "Provider=SQLOLEDB;Data Source=MyServer;" + 
			"Initial Catalog=Pubs;User Id=sa;Password=;";
			
		//Open connection.
		cnConn1 = new Connection();
		cnConn1.open(strCnn);
			
		//Open recordset.
		Recordset rs1 = null;
		rs1 = new Recordset();
		rs1.open("Employee",
				    cnConn1,
					AdoEnums.CursorType.KEYSET,
					AdoEnums.LockType.OPTIMISTIC,
					AdoEnums.CommandType.TABLE);
			
		//Try to read from an invalid field.
		Variant fieldVal;
		fieldVal = rs1.getField("invalidFieldName").getValue();			
	   }
	   catch( AdoException ae )
	   {
		// Notify user of any errors that result from ADO.
		// This prints "Unknown error(0x800a0cc1)".
		System.out.println(ae.getMessage());
	   }
   }
}
				
Before applying the fix, the error described in the "Symptoms" section of this article is displayed when the above code is run.

After the fix has been applied, this code produces the following error instead:
Item cannot be found in the collection corresponding to the requested name or ordinal.
This message is correct, because we are requesting an invalid field name.

Properties

Article ID: 291014 - Last Review: February 27, 2014 - Revision: 1.2
APPLIES TO
  • Microsoft ActiveX Data Objects 2.5
  • Microsoft ActiveX Data Objects 2.6
  • Microsoft Visual J++ 6.0 Standard Edition
Keywords: 
kbnosurvey kbarchive kbhotfixserver kbqfe kbbug kbfix kbmdac260sp1fix KB291014

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com