Partager via


CRecordset::IsFieldNullable

Returns nonzero if the specified field in the current record can be set to Null (having no value).

BOOL IsFieldNullable( 
   void * pv  
);

Parameters

  • pv
    A pointer to the field data member whose status you want to check, or NULL to determine if any of the fields can be set to a Null value.

Remarks

Call this member function to determine whether the specified field data member is "nullable" (can be set to a Null value; C++ NULL is not the same as Null, which, in database terminology, means "having no value").

Notes

If you have implemented bulk row fetching, you cannot call IsFieldNullable. Instead, call the GetODBCFieldInfo member function to determine whether a field can be set to a Null value. Note that you can always call GetODBCFieldInfo, regardless of whether you have implemented bulk row fetching. For more information about bulk row fetching, see the article Recordset: Fetching Records in Bulk (ODBC).

A field that cannot be Null must have a value. If you attempt to set a such a field to Null when adding or updating a record, the data source rejects the addition or update, and Update will throw an exception. The exception occurs when you call Update, not when you call SetFieldNull.

Using NULL for the first argument of the function will apply the function only to outputColumn fields, not param fields. For instance, the call

SetFieldNull(NULL);

will set only outputColumn fields to NULL; param fields will be unaffected.

To work on param fields, you must supply the actual address of the individual param you want to work on, such as:

SetFieldNull(&m_strParam);

This means you cannot set all param fields to NULL, as you can with outputColumn fields.

IsFieldNullable is implemented through DoFieldExchange.

Exceptions

This method can throw exceptions of type CDBException*.

Requirements

Header: afxdb.h

See Also

Concepts

CRecordset Class

CRecordset Members

Hierarchy Chart

CRecordset::IsFieldNull

CRecordset::SetFieldNull