Microsoft KB Archive/191971

= FIX: Incorrect Results Using Distinct Keyword with Recordset DTC =

Article ID: 191971

Article Last Modified on 3/7/2005

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q191971



SYMPTOMS
When supplying a SQL statement to the Recordset DTC that uses the DISTINCT keyword, the resulting recordset contains the wrong number of records in the resultset. Duplicate records should be ignored as specified by the DISTINCT keyword. However, duplicate records are being returned.



RESOLUTION
To work around this behavior, set the cursor location to be server-side:
 * 1) Open the Properties page of the Recordset DTC.
 * 2) Click the Advanced tab.
 * 3) Set the Cursor Location property to "2 - Use server-side cursors."



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

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
The following steps require a data connection to SQL Server's PUBS database:  Create a new Active Server Pages (ASP) page. Drag a Recordset DTC from the Design-Time Controls toolbox onto the page below the  tag. Right-click it, and open its Property page. In the General tab, set its Connection property to the PUBS data connection. Set the radio button in the "Source of Data" group box to the SQL Statement option. In the area below the SQL Statement button, type the following:

Select DISTINCT title_id from titleauthor

</li> Close the Property page.</li> Drag a grid to the page.</li> Right-click and open its Property page. On the Data tab, set the Recordset property to the recordset on the page (usually Recordset1). In the Available Fields, choose the title_id field.</li> Click OK to close the Property page.</li> Save the page and preview it in the browser.</li></ol>

A grid will appear and contain 25 total records across two pages. (The default records per page is 20 for the grid. The grid should show 20 records on the first page, and 5 on the next page).

However, when running the same query in SQL Server's ISQL_w, or by changing the Recordset DTC's curor location to "server-side" the following correct results are returned (this is from ISQL_w): <pre class="fixed_text">  title_id BU1032 BU1111 BU2075 BU7832 MC2222 MC3021 PC1035 PC8888 PC9999 PS1372 PS2091 PS2106 PS3333 PS7777 TC3218 TC4203 TC7777

(17 row(s) affected)

Keywords: kbbug kbfix kbctrl kbvs600sp3fix KB191971

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.