Microsoft KB Archive/241897

= BUG: SQLOLEDB IRowset->GetNextRows Causes Access Violation after Fetching 131,000 Rows =

Article ID: 241897

Article Last Modified on 8/23/2001

-

APPLIES TO


 * Microsoft OLE DB Provider for SQL Server 7.01

-



This article was previously published under Q241897



SYMPTOMS
When you fetch a block of rows from SQL Server using the SQLOLEDB provider version 7.01.0690, you may encounter an Access Violation (av) when the block size (cRows) is greater than 607. The access violation occurs on the call to IRowset->GetNextRows that fetches row 131,000. If the cRows value is set to 607 or less, the access violation does not occur. The datatype of the fields being fetched or the number of fields does not have an effect on this bug.



RESOLUTION
Do not set the cRows parameter of IRowset->GetNextRows to a value greater than 607. Set the cRows parameter to 607 or less.



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

This problem was corrected in MDAC 2.5.



MORE INFORMATION
The following code causes the access violation when IRowset->GetNextRows fetches row 131,000: hr = pICommand->QueryInterface( IID_ICommandText, ( void ** ) & pICommandText );

DBPROPSET  dbPropSet; DBPROP     dbProp[2];

dbProp[0].dwPropertyID      = DBPROP_SERVERCURSOR; dbProp[0].dwOptions         = DBPROPOPTIONS_REQUIRED; dbProp[0].colid             = DB_NULLID; V_VT(&(dbProp[0].vValue))   = VT_BOOL; V_BOOL(&(dbProp[0].vValue)) = VARIANT_TRUE;

dbProp[1].dwPropertyID      = DBPROP_COMMITPRESERVE; dbProp[1].dwOptions         = DBPROPOPTIONS_REQUIRED; dbProp[1].colid             = DB_NULLID; V_VT(&(dbProp[1].vValue))   = VT_BOOL; V_BOOL(&(dbProp[1].vValue)) = VARIANT_TRUE;

dbPropSet.rgProperties      = dbProp; dbPropSet.cProperties       = 2; dbPropSet.guidPropertySet   = DBPROPSET_ROWSET;

hr = pICommand->QueryInterface( IID_ICommandProperties, ( void ** ) & pICommandProperties );

hr = pICommandProperties->SetProperties( 1, & dbPropSet );

pICommandProperties->Release;

hr = pICommandText->SetCommandText( DBGUID_DBSQL, wSQLString );

pICommandText->Release;

hr = pICommand->QueryInterface( IID_IAccessor, ( void ** ) & pIAccessor );

hr = pIAccessor->CreateAccessor( DBACCESSOR_ROWDATA,    2,    rgBinding,     sizeof( MyBuffer ),    & hAccessor,    & ulErrorBinding[0] );

hr = pICommand->Execute( NULL,    IID_IRowset,     NULL,     & cRowsAffected,     ( IUnknown ** ) & pIRowset );

while( TRUE ) {   hr = pIRowset->GetNextRows( NULL, 0, 608, & cRows, & pRows );

// it is not necessary to call IRowset->GetData to // reproduce this bug hr = pIRowset->ReleaseRows( cRows, pRows, NULL, NULL, NULL ); }

Keywords: kbbug kbfix kbmdac250fix KB241897

-

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

© Microsoft Corporation. All rights reserved.