Bug #3857 auto-increment non-null primary keys are reported as nullable in ADO
Submitted: 22 May 2004 12:13 Modified: 21 Jul 2004 22:26
Reporter: Adrian Sandor Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version:3.51.07 OS:Windows (Windows XP)
Assigned to: Peter Harvey CPU Architecture:Any

[22 May 2004 12: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)
[21 Jul 2004 22: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 9:30] Adrian Sandor
ok, then how can I find out if a field can contain NULL values, without using MySQL-specific SQL commands?
[24 Aug 2010 7:26] Tonci Grgin
Bug#56209 has been marked as duplicate of this report.