Click to See Complete Forum and Search --> : Not able to differentiate between empty column and null column


Praveen Kumar
June 15th, 1999, 12:26 PM
We are experiencing a problem in finding out whether a column value is NULL or not NULL in VC++;
We are trying out this in ADO programming. We are expecting your useful reply in this regard.


vcpraveen

wigg
June 15th, 1999, 02:01 PM
I tend to use the CDaoRecordSet::GetFieldValue() method to grab the value of a field if I don't know whether the column is populated or not.


COleVariant varValue;

// Get field value.
rs.GetFieldValue(_T("MY_COLUMN"), varValue);

// Check if it is NULL or a real value...

Wayne Fuller
June 15th, 1999, 02:56 PM
If you are using the #import ADO version then do the following.
_variant_t var = rs->GetCollect(L"SomeField");

if ( var.vt != VT_NULL )
{
// Assign the value
}




Wayne

June 16th, 1999, 10:48 AM
If you are using DBF_ for field exchange, MFC substitutes a "psuedo" value for NULL columns. These are defined in afxdb_.h