DOC: IsFieldNull() Does Not Accept NULL

Last reviewed: September 4, 1997
Article ID: Q173423
The information in this article applies to:
  • Microsoft Visual C++, 32-bit Enterprise Edition, versions 4.2, 5.0, 5.0sp1

SUMMARY

The documentation for Visual C++ states the following about the argument for CDatabase::IsFieldNull():

   pv   A pointer to the field data member whose status you want to check,
        or NULL to determine if any of the fields are Null.

According to the documentation, you should be able to pass in NULL to determine if any of the fields are null.

Beginning with Visual C++ version 4.2, this is not correct. Passing a value of NULL will cause an exception to be thrown.

MORE INFORMATION

You can write a function to check whether any fields are null. Here is what the function would look like:

   BOOL CYourRecordset::IsAnyFieldNull()
   {
      for (DWORD nIndex = 0; nIndex<=m_nFields-1; nIndex++)
      {
        if (IsFieldStatusNull(nIndex))
             return TRUE;
      }
      return FALSE;
   }

Notice that the IsAnyFieldNull() function uses an undocumented function IsFieldStatusNull(). This function is in the implementation section of the CRecordset class so note that the function may change in future releases of MFC. To write code that is not dependent upon undocumented functions, call IsFieldNull() for each field member in the recordset instead.
Keywords          : MfcDatabase
Technology        : odbc kbMfc
Version           : WINDOWS:4.2,5.0,5.0sp1
Platform          : WINDOWS
Issue type        : kbdocerr


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 4, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.