Microsoft KB Archive/302248

= FIX: SQLOLEDB Does Not Work with DBACCESSOR_OPTIMIZED Flag and SSPROP_ENABLEFASTLOAD =

Article ID: 302248

Article Last Modified on 9/26/2005

-

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

-



This article was previously published under Q302248



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



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.
 * 1) include 
 * 2) include 
 * 3) define DBINITCONSTANTS 1
 * 4) include 

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

CDataSource ds; hr = ds.Open( _T(&quot;SQLOLEDB&quot;), _T(&quot;server&quot;), _T(&quot;user&quot;), _T(&quot;password&quot;) ); 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 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&quot;Pubs.dbo.authors&quot;; CComPtr 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 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); }

Keywords: kbbug kbfix kbqfe kbsqlserv2000presp2fix kbmdac260sp2fix kbhotfixserver KB302248

-

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

© Microsoft Corporation. All rights reserved.