MFC - CRecordset::GetFieldValue throws "Invalid Argument Value" exception when reading a Non-null SQL Server VARBINARY(MAX) Field value - by Goldorak84

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
0
Sign in
to vote
ID 692769 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 10/3/2011 8:27:08 AM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration

Description

In MFC, while trying to read data from a SQL Server VARBINARY(MAX) field, the CRecordset::GetFieldValue function asserts in dbcore.cpp, at 
void* PASCAL CRecordset::GetDataBuffer(CDBVariant& varValue,
	short nFieldType, SQLLEN* pnLen, short nSQLType, SQLULEN nPrecision)
function, in the line 
	// better know the length!
               ASSERT(nPrecision != 0);
	*pnLen = nPrecision;

After that, it throws an  "Invalid Argument Value" exception. I can't read the value.
It worked before with SQL Server's IMAGE type, but it's deprecated, so I try not to use it 
Sign in to post a comment.
Posted by Goldorak84 on 10/27/2011 at 11:26 AM
Is it possible to get a hotfix for this?
Posted by Microsoft on 10/25/2011 at 4:46 PM
Hello,

Thanks again for the report. This issue has been fixed in MFC for the next major release of Visual Studio.

Pat Brenner
Visual C++ Libraries Development
Posted by Goldorak84 on 10/11/2011 at 10:43 AM
Hi Pat, No, my application doesn't work in release. The code doesn't seem to handle the nPrecision==zero case, it results in an exception thrown.
Posted by Microsoft on 10/7/2011 at 1:02 PM
Hello,

Thanks for the report. It's possible that the assertion is invalid (in other words, it may be valid for nPrecision to be zero). Does your application work in Release configuration? Can you step through the code and verify that the nPrecision=zero case is handled correctly?

I may be able to fix the issue by simply removing the assertion, so I want to check whether that is a valid fix. Thanks!

Pat Brenner
Visual C++ Libraries Development
Posted by MS-Moderator07 [Feedback Moderator] on 10/3/2011 at 7:34 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 10/3/2011 at 8:40 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)