Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: SQLOLEDB Does Not Work with DBACCESSOR_OPTIMIZED Flag and SSPROP_ENABLEFASTLOAD


View products that this article applies to.

This article was previously published under Q302248

↑ Back to the top


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.

↑ Back to the top


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� 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� 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.

↑ Back to the top


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.

↑ Back to the top


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);
}
				

↑ Back to the top


Keywords: KB302248, kbsqlserv2000presp2fix, kbmdac260sp2fix, kbfix, kbbug, kbqfe, kbhotfixserver

↑ Back to the top

Article Info
Article ID : 302248
Revision : 7
Created on : 9/26/2005
Published on : 9/26/2005
Exists online : False
Views : 577