Microsoft Knowledge Base Email Alertz

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

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 241897 - Last Review: August 23, 2001 - Revision: 1.0

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

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<BR/>
	// reproduce this bug
	hr = pIRowset->ReleaseRows( cRows, pRows, NULL, NULL, NULL );
}
				

APPLIES TO
  • Microsoft OLE DB Provider for SQL Server 7.01
Keywords: 
kbbug kbfix kbmdac250fix KB241897
Retired KB ArticleRetired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate