The information in this article applies to:
SYMPTOMS
After calling a stored procedure that has a Varchar (Text) output parameter, no errors are thrown, but the variable that holds the output is always null. This problem only happens in Unicode builds. Q182386 PRB: Varchar Output Parameter Causes "Data Truncated" ErrorNote that text output parameters do not work at all unless the workaround in that article has been implemented. CAUSEThe cause is a bug in the Unicode section of the RFX_Text function. The Unicode section in the RFX_TextOut function is setting up a Proxy parameter, binding the real parameter to the proxy parameter, and then allocating new memory to the real parameter. The data is getting put into the bound proxy parameter correctly, but it's not getting transfered to the data member. RESOLUTION
The resolution is in two parts:
For example, assume we have one varchar output parameter and that we have implemented the code suggested in the Microsoft Knowledge Base article Q182386 in a function called RFX_TextOut. Assuming we have a CRecordset named RSTestTextOut that contains a CString data member called strTextOut that will hold the data, you would implement the workaround as follows:
Our variable strTextOut now holds the value of the output parameter returned from the stored procedure. If you wanted to be more strict, you could wrap that in an #ifdef _UNICODE ... #endif section, because it's only needed in Unicode builds. Of course, if you had more than one varchar output parameter, you would need a similar line for each parameter, such as:
REFERENCESFor additional information about Text parameters in Unicode builds, please see the following article in the Microsoft Knowledge Base: Q182386 PRB: Varchar Output Parameter Causes "Data Truncated" Error Additional query words:
Keywords : kbDatabase kbMFC kbODBC kbVC500 kbVC600 kbGrpVCDB |
Last Reviewed: May 7, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |