|
-
August 25th, 2004, 12:07 PM
#1
Empty string stored as NULL by MFC for MS SQL 2K
Trying to following other SQL recommendations, many of my table columns do not allow NULLs.
However, when I have code like this:
recordSet.Edit();
recordSet.m_MyColumn = '';
recordSet.Update();
With "MyColumn" not allowing NULLs, I get the exception "Cannot insert NULL values into column..."
This is because of this code in MFC during DoFieldExchange RFX_Text (DBRFX.cpp)
case CFieldExchange::MarkForUpdate:
if (value.IsEmpty())
pFX->m_prs->SetNullFieldStatus(nField - 1); else
pFX->m_prs->ClearNullFieldStatus(nField - 1);
value.IsEmpty is TRUE, so the field (column) is marked as NULL.
Any suggestions how to get the empty string into MyColumn?
Thanks for reading this far.
Jim O'Leary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|