BUG: MS Access ODBC Driver Does Not Expose adFldIsNullable to ADO (185823)
The information in this article applies to:
- ActiveX Data Objects (ADO) 1.0
- ActiveX Data Objects (ADO) 1.5
- ActiveX Data Objects (ADO) 2.0
- Microsoft ODBC Driver for Access 3.5
- Microsoft ODBC Driver for Access 4.0
- Microsoft OLE DB Provider for Jet 3.51
This article was previously published under Q185823 SYMPTOMS When using Microsoft ActiveX Data Objects (ADO) with the
Microsoft Access ODBC driver, attempts to programmatically check the
nullability of a field with the ADO Field "Attributes" property, returns True
even if the field is a required (non-nullable) field.
Using Microsoft
ActiveX Data Objects (ADO) with the Microsoft Jet OLE DB Provider version 3.51
also returns True when checking the nullability of a field, even if the field
is a required (non-nullable) field. CAUSE ADO calls the ODBC API function SQLColAttributes(), with
the SQL_COLUMN_NULLABLE flag, to determine if a field is nullable with the
Microsoft Access ODBC driver. The Microsoft Access ODBC driver does not
properly report the nullability of a column using this API function. The
Microsoft Access ODBC driver reports that every field is nullable when using
the SQLColAttributes() ODBC API function.
The functionality was not
added to the Microsoft OLE DB Provider for Jet version 3.51. RESOLUTION The Microsoft Access ODBC driver does not provide a
programmatic means of determining the nullability property of a column in a
table. You can attempt to add a record and trap for the following error number
returned by ADO: -2147217887 (0x80040E21)
This error returns the following error description:
[Microsoft][ODBC Microsoft Access 97 Driver] The field
'<fieldname>' can't contain a Null value because the Required property
for this field is set to True. You can also use Microsoft Data
Access Objects (DAO) to open a table and this properly returns the nullability
of a field using the "Required" property of the Field object. This
functionality is available with the Microsoft Jet OLEDB Provider 4.0 and later
that comes with Microsoft Data Access Objects 2.1 and later. You may
obtain Microsoft Data Access Objects 2.1 and later from the following site: STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
This is not a problem with MDAC versions 2.1
and later, as they install the Microsoft JET OLEDB Provider 4.0, which has the
proper functionality.
This was fixed in Jet 4.0, not supported in Jet 3.51. Jet
4.0 was first available in MDAC 2.1 GA.
Modification Type: | Minor | Last Reviewed: | 7/28/2003 |
---|
Keywords: | kbBug kbDatabase kbDriver kbJET kbMDACNoSweep kbpending kbProvider KB185823 |
---|
|