Bug #3857 auto-increment non-null primary keys are reported as nullable in ADO
Submitted: 22 May 2004 14:13 Modified: 22 Jul 2004 0:26
Reporter: Adrian Sandor
Status: Not a Bug
Category:Connector/ODBC Severity:S3 (Non-critical)
Version:3.51.07 OS:Microsoft Windows (Windows XP)
Assigned to: Bugs System Target Version:

[22 May 2004 14:13] Adrian Sandor
Description:
The ADO Field object has an Attributes property that shows (among other things) if the
field may be null or not. Generally it is correct, but if I have a field like this:
`ID` int(11) NOT NULL auto_increment,
PRIMARY KEY  (`ID`)
then it wrongly shows it is nullable.

How to repeat:
Check rst.Fields("ID").Attributes for adFldIsNullable (32) and adFldMayBeNull (64)
[22 Jul 2004 0:26] Timothy Smith
This is because MySQL reports the DEFAULT value for such a column as NULL.  It means, if
you insert a NULL value into the column, you will get the next integer value for the
table's auto_increment counter.
[10 Sep 2004 11:30] Adrian Sandor
ok, then how can I find out if a field can contain NULL values, without using
MySQL-specific SQL commands?