CRecordset::IsFieldNullable

BOOL IsFieldNullable( void* pv );
throw( CDBException );

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 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”).

Note   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) in Visual C++ Programmer’s Guide.

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 outputColumns, not params. For instance, the call

SetFieldNull( NULL );

will set only outputColumns to NULL. Params will be unaffected.

To work on params, 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 params NULL, as you can with outputColumns.

IsFieldNullable is implemented through DoFieldExchange.

CRecordset OverviewClass MembersHierarchy Chart

See Also   CRecordset::IsFieldNull, CRecordset::SetFieldNull