SUMMARY
CRecordset::SetFieldNull() causes an assert or an access
violation if called for a parameter. Even if no assert or access violation
occurs, the parameter may not be set to Null.
If SetFieldNull() is
called before the recordset is open, the assert occurs in DBRFX.CPP at line 48:
ASSERT(prs->m_hstmt != SQL_NULL_HSTMT);
If SetFieldNull() is called after the recordset is open, then a call to
CRecordset::Requery() may assert in DBCORE.CPP at line 4055 or line 4062:
ASSERT(nParam < m_nParams);
If SetFieldNull() is called after the recordset is closed and before it
is reopened, you will see an access violation in DBCORE.CPP at line 4057:
m_pbParamFlags[nParam] |= AFX_SQL_FIELD_FLAG_NULL;
or at line 4064:
m_pbParamFlags[nParam] &= ~AFX_SQL_FIELD_FLAG_NULL;
NOTE: Visual C++ 5.0 has a new function called SetParamNull() that you
can use to avoid this problem. SetFieldNull() in Visual C++ 4.2 was not
designed to be called before calling CRecordset::Open(), and was not designed
to handle parameters.
The following
files are available for download from the Microsoft Download
Center:
Paramset.exe For additional information about how
to download Microsoft Support files, click the following article number to view
the article in the Microsoft Knowledge Base:
119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
Microsoft has confirmed this to be a bug in the Microsoft
products listed at the beginning of this article. The problem has been fixed
with Visual C++ version 5.0 by adding a new function called SetParamNull().