Microsoft Knowledge Base Email Alertz

(302248) - Using the Microsoft OLEDB Provider for SQL Server (SQLOLEDB) that comes with Microsoft Data Access Components (MDAC) version 2.6 or 2.6 SP1, when you set the value of the SSPROP_ENABLEFASTLOAD property to true in the SQLSERVERDATASOURCE property set,...

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: 302248 - Last Review: September 26, 2005 - Revision: 4.3

FIX: SQLOLEDB Does Not Work with DBACCESSOR_OPTIMIZED Flag and SSPROP_ENABLEFASTLOAD

This article was previously published under Q302248

On This Page

SYMPTOMS

Using the Microsoft OLEDB Provider for SQL Server (SQLOLEDB) that comes with Microsoft Data Access Components (MDAC) version 2.6 or 2.6 SP1, when you set the value of the SSPROP_ENABLEFASTLOAD property to true in the SQLSERVERDATASOURCE property set, and then attempt to create an accessor with the DBACCESSOR_OPTIMIZED flag, the CreateAccessor() call returns DB_E_BADACCESSORFLAGS.

RESOLUTION

To resolve this problem, obtain the latest service pack for SQL Server 2000, the latest service pack for MDAC 2.6, or the hotfix referenced below. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
290211  (http://kbalertz.com/Feedback.aspx?kbNumber=290211/EN-US/ ) INF: How to Obtain the Latest SQL Server 2000 Service Pack
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
300635  (http://kbalertz.com/Feedback.aspx?kbNumber=300635/EN-US/ ) INFO: How to Obtain the Latest MDAC 2.6 Service Pack

Hotfix

The English version of this fix should have the following file attributes or later:
Date         Time      Version         Size          File name     Platform
---------------------------------------------------------------------------
23-MAY-2001  18:16:00  2000.80.297.04  91,584 bytes  Sqloledb.dll  x86
23-MAY-2001  18:16:00  2000.80.297.06   1,440 bytes  Sqloledb.rll  x86	
				

WORKAROUND

To work around this problem, do not set the SSPROP_ENABLEFASTLOAD flag to TRUE. If you need to set this flag to TRUE, you must install the fix.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in SQL Server 2000 Service Pack 2 and MDAC 2.6 Service Pack 2.

MORE INFORMATION

To reproduce this behavior, copy the code below into a Microsoft Visual C++ console application, and then compile the code. Note that you may need to change the datasource name, user ID, and password.
#include <atldbcli.h>
#include <assert.h>
#define DBINITCONSTANTS 1
#include <sqloledb.h>

void main()
{
	HRESULT hr = CoInitialize( NULL );
	assert( SUCCEEDED(hr) );

	CDataSource ds;
	hr = ds.Open( _T("SQLOLEDB"), _T("server"), _T("user"), _T("password") );
	assert( SUCCEEDED(hr) );

	// Set the value of the SSPROP_ENABLEFASTLOAD property to true.

	CDBPropSet ps( DBPROPSET_SQLSERVERDATASOURCE );
	bool apret = ps.AddProperty( SSPROP_ENABLEFASTLOAD, true );
	CComPtr<IDBProperties> spProperties;
	hr = ds.m_spInit.QueryInterface( &spProperties );
	hr = spProperties->SetProperties( 1, &ps );

	CSession sess;
	hr = sess.Open( ds );

	DBID id;
	id.eKind = DBKIND_NAME;
	id.uName.pwszName = L"Pubs.dbo.authors";
	CComPtr<IRowsetFastLoad> pIFastLoad;
	hr = sess.m_spOpenRowset->OpenRowset( NULL, &id, NULL, IID_IAccessor, 0, NULL, (IUnknown **) &pIFastLoad );

	 DBBINDING binding = { 1, 0, 0, 0, NULL, NULL, NULL, DBPART_VALUE,
	   DBMEMOWNER_CLIENTOWNED, DBPARAMIO_NOTPARAM,100uL, 0, DBTYPE_STR,  0, 0 };
	HACCESSOR h;

	CComPtr<IAccessor> spAccessor;
	hr = pIFastLoad->QueryInterface(IID_IAccessor, (void **) &spAccessor);
        //You will get the error here.
	hr = spAccessor->CreateAccessor( DBACCESSOR_ROWDATA | DBACCESSOR_OPTIMIZED , 1,&binding,0,& h, NULL );
	AtlTraceErrorRecords(hr);
}
				

APPLIES TO
  • Microsoft Data Access Components 2.6
  • Microsoft Data Access Components 2.6 Service Pack 1
  • Microsoft SQL Server 2000 Standard Edition
  • Microsoft OLE DB Provider for SQL Server 2000 2000.80.194
Keywords: 
kbhotfixserver kbqfe kbbug kbfix kbmdac260sp2fix kbsqlserv2000presp2fix KB302248
       

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