Article ID: 157071
Article Last Modified on 11/21/2006
// If long data, may need to call SQLGetData again
if (nLen < nActualSize &&
(nSQLType == SQL_LONGVARCHAR || nSQLType == SQL_LONGVARBINARY))
For 1-character SQL_LONGVARCHAR data, GetData() will fail because the
buffer must be large enough to hold the data plus the NULL termination
byte. Then, GetData() returns an actual size of 1, which does not include
the NULL byte.
class CGetSet : public CRecordset
{
public:
CGetSet(CDatabase* pDatabase = NULL);
};
and GetSet.CPP:
#include "stdafx.h"
#include "GetSet.h"
CGetSet::CGetSet(CDatabase* pdb)
: CRecordset(pdb)
{
}
// If long data, may need to call SQLGetData again
if (nLen < nActualSize &&
(nSQLType == SQL_LONGVARCHAR || nSQLType == SQL_LONGVARBINARY))
to:
// If long data, may need to call SQLGetData again
if (nLen <= nActualSize &&
(nSQLType == SQL_LONGVARCHAR || nSQLType == SQL_LONGVARBINARY))
Additional query words: kbDatabase kbMFC kbVC420bug kbVC500fix kbDSupport
Keywords: kbbug kbfix kbtshoot KB157071