V1xNullBehavior Property

See Also        Applies To

Indicates whether zero-length strings ("") used in code to fill Text or Memo fields are converted to Null.  The setting or return value is a Boolean that is True if zero-length strings are converted to Null.

Syntax

There is no member function to explicitly access this property.  See Usage below for an example of how this property is managed.

Remarks

This property applies to Microsoft Jet database engine version 1.x databases that have been converted to Microsoft Jet database engine version 2.0 or 3.x databases.

Note The Microsoft Jet database engine automatically creates this property when it converts a version 1.x database to a version 2.0 or 3.x database. A 2.0 database will retain this property when it is converted to a 3.x database.

If you change this property setting, you must close and then reopen the database for your change to take effect.

For fastest performance, modify code that sets any Text or Memo fields to zero-length strings so that the fields are set to Null instead, and remove the V1xNullBehavior property from the Properties collection.

Usage

/* Assume that you want to change the way nulls are handled in a converted database.
Notes:
   1) We'll break getting the property and the value into two steps for readability.
   2) The COleVariant "==" operator requires two variants.
*/
CdbDBEngine   dbeng;
CdbDatabase   dbs;
CdbProperty   prp;
COleVariant   vTrue((short)TRUE, VT_BOOL), 
         vFalse((short)FALSE, VT_BOOL),
         vVal;
//
dbs = dbeng.OpenDatabase(_T("AConvertedV1.mdb"));
prp = dbs.Properties[_T("V1xNullBehavior")];
vVal = prp.GetValue();      // note 1
if (vVal == vTrue)          // note 2
   {
   prp.SetValue(&vFalse);
   dbs.Close();
   dbs = dbeng.OpenDatabase(_T("AConvertedV1.mdb"));
   }
...