FIX: "Data Truncated Column" Erroneously Reported (140534)



The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), when used with:
    • Microsoft Visual C++

This article was previously published under Q140534

SYMPTOMS

Each time the application moves to a another record, you receive the following ODBC error message:
Warning: ODBC Success With Info, Data truncated column X.
State:01004,Native:0,Origin:[Microsoft][ODBC Single-Tier Driver]
where X represents the column number.

CAUSE

The error message occurs when you use CLongBinary field variables with database tracing enabled. Database tracing is enabled by running Tracer.exe and selecting the DB Tracing check box.

In the RFX_LongBinary() function, the following code returns the SQL_SUCCESS_INFO warning:
   case CFieldExchange::Fixup:
   // Give empty buffer to find size of entire LongBinary
   AFX_SQL_ASYNC(pFX->m_prs, ::SQLGetData(pFX->m_prs->m_hstmt,
        (unsigned short int)nField, SQL_C_DEFAULT, &w, 0, plLength));
				
The RFX routine determines the size of the binary field by calling the SQLGetData() function with a zero-length buffer. The variable plLength provides the length of the binary field after the call. Because a zero-length buffer is passed to SQLGetData(), ODBC returns a warning indicating that there may be a problem.

RESOLUTION

Ignore the warning.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

This problem is fixed in Visual C++ 4.0, and no reports were made for Visual C++ 2.x.

NOTE: Visual C++ 4.0 is a 32-bit product; therefore, the bug is not fixed in any version of 16-bit Visual C++.

Modification Type:MajorLast Reviewed:10/24/2003
Keywords:kbbug kbDatabase kbfix kbVC400fix KB140534