Search

CRecordset/DoFieldExchange not working properly in Visual Studio 2010 by Synergy2010

Active

3
0
Sign in
to vote
Type: Bug
ID: 574974
Opened: 7/14/2010 5:44:42 AM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
We use CDatabase/Crecordset MFC. With this version DoFieldExchange has changed. For example, RFX_Long would handle NULL values in the database, whereas now it will place an arbitrarily large invalid value in the variable. This happens with all the RFX functions. In additon, it seems that SetFieldNull no longer works correctly.

We have been using CDatabase/CRecordset for over 8 years since Visual Studio 2003 and this code has NOT changed. Everything works in Visual Stuido 2003, 2005 and 2008 but fails in 2010. Has there been a specific change to how DoFieldExchange and SetFieldNull/IsFieldNull must be used or is this a bug??
Details (expand)

Product Language

English

Visual Studio Version

Visual Studio 2010

Operating System

Windows 7

Operating System Language

English

Steps to Reproduce

Simply implement any DoFieldExchange on a table that has numeric columns for example so that you would call RFX_Long().

Actual Results

Integral variable passed to RFX_Long() has huge, invalid value for rows that have NULLs in that column.

Expected Results

Value of integer bound to NULL columns should be zero (or just left alone)
      You can indicate your satisfaction with how Microsoft handled this issue by completing this quick 3 question survey.

 

File Attachments
File Name Submitted By Submitted On File Size  
SimpleDB.zip 7/15/2010 31.89 MB
Sign in to post a comment.
Posted by erisan on 2/7/2011 at 7:20 AM
I applied VS2010 SP1 Beta, release build works fine but debug build still don't handle NULL values correctly with IsFieldNull(). Anyone experiencing the same issue with SP1 or is it just my debug builds?
Posted by Neil Hickox on 12/7/2010 at 5:09 PM
I ran into this issue after hundreds of man hours of converting our code to VS2010. After trying the original fix that was proposed and realizing it didn't work, as I was about to run screaming into the street, I saw the link that it was going to be fixed in SP1, great! Then I realized from that thread that it has been OVER A YEAR since this problem was found and there didn't appear to be a fix yet!!! So once again before running into the street, I checked MSDN and to my great surprise SP1 Beta had just been uploaded today!!!!!!

I can confirm that so far that VS2010 SP1 Beta fixes this issue for us with no code changes required.

Posted by Goldorak84 on 11/26/2010 at 10:21 AM
And when this service pack will be available? we have purchased over 10 000$ of visual studios 2010 and we can't use them because of that regression.
Posted by Microsoft on 9/27/2010 at 1:30 PM
Hello,

Thanks again for the report. This issue has been fixed for Visual Studio 2010 SP1.

Pat Brenner
Visual C++ Libraries Development
Posted by BillInPA on 8/6/2010 at 9:22 AM
I am a co worker of Synergy2010
We like everyone have a target for release of current efforts
That would be end of Septemper
A hot patch to get us out the door would be much appreciated, unless a service pack is expected by that time.
Posted by Microsoft on 8/5/2010 at 11:29 AM
Hello,

Thanks for the report. We have fixed this issue in MFC by reverting to VS2008 behavior in the CRecordSet class and plan to include this fix in a service pack for VS2010.

Pat Brenner
Visual C++ Libraries Development
Posted by Microsoft on 7/16/2010 at 1:45 AM
We have got your files.

Thank you
Posted by Synergy2010 on 7/15/2010 at 7:27 AM
I have attached the file SimpleDB.zip which is just a wizard generated MFC database app that uses a CRecordset derived class. The app assumes the existence of an SQL Server table called TestTable which looks like:

CREATE TABLE [dbo].[TestTable](
    [ID] [char](10) NOT NULL,
    [TxtCol1] [varchar](50) NOT NULL,
    [NumCol1] [numeric](10, 0) NULL,
CONSTRAINT [PK_TestTable] PRIMARY KEY CLUSTERED )

The ChildView class has an event handler for the menu item File/Run that instantiates the CRecordset derived class, opens it, moves through the rows in the recordset and closes it. If any row in the table has a NULL value for NumCol1 you will see the problem. RFX_Double() in DoFieldExchange() will return and the member variable that is bound to that column will have a huge, invalid value. I have tested this with RFX_Long as well with the same result on integral columns.

Please note that our software has been running for 8 years using CRecordset build with VS 2003, 2005 and 2008 with NO problems. As soon as we build with VS 2010 we get the above behavior - even in just a wizard created database app.

Posted by Microsoft on 7/14/2010 at 7:04 PM

Thanks for reporting the issue.
In order to fix the issue, we must first reproduce the issue in our labs. We are unable to reproduce the issue with the steps you provided.

Could you please attach a zipped project file to this feedback through our site to help us reproduce the issue?

Thanks again for your efforts and we look forward to hearing from you.
Visual Studio Product Team
Posted by Microsoft on 7/14/2010 at 5:04 PM
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)
Sign in to post a workaround.