Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: adFldIsNullable and adFldMayBeNull Field Attributes for Informix DBs


Message #1 by "Scott Korin" <korinsco@p...> on Fri, 9 Aug 2002 20:25:04
I have an asp page that needs to know whether or not a field is nullable 
(and needs to do it dynamically).  With SQL Server, I can check the 
Attributes value of the ADODB.Field object for adFldIsNullable or 
adFldMayBeNull and it works fine.

With Informix, it does not work.  For key values, the Attributes value is
24 (adFldUnknownUpdatable and adFldFixed).  For non key fields, the 
Attributes value is 8 (adFldUnknownUpdatable).

I am using a disconnected, client side cursor, and the recordset has an 
adLockBatchOptimistic lock (so I can find out which fields are keys).

I am using a DSN for the connection, and the Informix ODBC driver is 3.34.

Anyone have any ideas?

Thanks
Message #2 by "Scott Korin" <korinsco@p...> on Fri, 9 Aug 2002 21:32:34
Okay, I'm just not with it today.  I was looking for problems that weren't 
there.  I had code that did the following:

        For Each fld In rst1.Fields
            blnKey = false
            bnRequired = false
            If (fld.Attributes And adFldKeyColumn) = adFldKeyColumn Then
                 blnKey = true
            End If
            
            strResult = strResult & vbCrLf & vbTab & "Is Required: "
            If (adFldIsNullable And fld.Attributes) = adFldIsNullable Or _
                (adFldMayBeNull And fld.Attributes) = adFldMayBeNull Then
            
                 blnRequired = true
            End If
       Next

but the check for isnullable and maybenull should be the inverse if I want
to check for REQUIRED fields:
If Not (adFldIsNullable And fld.Attributes) = adFldIsNullable Or _
       (adFldMayBeNull And fld.Attributes) = adFldMayBeNull) Then
     blnRequired = true
end if

So my mistake.  Doh!


> With Informix, it does not work.  For key values, the Attributes value is
2> 4 (adFldUnknownUpdatable and adFldFixed).  For non key fields, the 
A> ttributes value is 8 (adFldUnknownUpdatable).

  Return to Index