Microsoft KB Archive/301199

= FIX: Access Violation Passing ADO Command Object to ADO Recordset Open with MDAC 2.6 =

Article ID: 301199

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 ActiveX Data Objects 2.6

-



This article was previously published under Q301199



SYMPTOMS
When you pass an ActiveX Data Objects (ADO) Command object to the ADO Recordset.Open method, an access violation in Msado15.dll may occur.



RESOLUTION
This problem has been corrected in MDAC 2.6 Service Pack 2 (SP2) and MDAC 2.7. If you cannot upgrade to these versions, a hotfix is also available.

For additional information about MDAC 2.6 SP2, 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

The English version of this fix should have the following file attributes or later:

 Date        Version       Size     File name     Platform --- 25-JUN-2001 2.61.7625.0   528,656  Msado15.dll   x86



WORKAROUND
To work around this problem, do not pass a Command object to the Open method of a Recordset object.



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 Microsoft Data Access Components 2.6 Service Pack 2 and MDAC 2.7.



MORE INFORMATION
To reproduce the problem, run the following Microsoft Visual Basic for Applications (VBA) code: Sub MergePropSetCrash Dim conn As ADODB.Connection Dim cmd As ADODB.Command Dim rs As ADODB.recordset

Set conn = New ADODB.Connection conn.Open &quot;Provider=MSDASQL;Driver={SQL Server};&quot; & _ &quot;Server=.;Database=Pubs;TrustedConnection=Yes;&quot; Set cmd = New ADODB.Command Set cmd.ActiveConnection = conn cmd.CommandType = adCmdText cmd.CommandText = &quot;select 1&quot; cmd.Execute Set rs = New ADODB.recordset rs.CursorLocation = adUseClient cmd.CommandText = &quot;select 2&quot; rs.Open cmd,, adOpenKeyset, adLockOptimistic, adCmdText

End Sub An attached debugger or crash dump displays a call stack that resembles the following: Access violation - code c0000005 (first chance) eax=00e46608 ebx=00e45fcc ecx=00680a82 edx=01a03400 esi=00e46bbc edi=00e47000 eip=1f48883d esp=0012fa04 ebp=0012fa34 iopl=0 nv up ei pl nz na po nc cs=001b ss=0023 ds=0023 es=0023 fs=0038 gs=0000 efl=00010206 msado15!MergePropSets+1dd: 1f48883d f3a5           rep  movsd ds:00e46bbc=00000000 es:00e47000=???????? 0:000> kv RetAddr Args to Child 1f487ce3 0012fa68 0012fa6c 00e45f98 msado15!MergePropSets+0x1dd 1f486c47 00001000 00000000 00000001 msado15!CQuery__SetProperties+0x215 1f453eb4 00000003 0042b700 00000000 msado15!CQuery__Execute+0x700 1f45b655 00e43700 00000003 0042b700 msado15!CCommand___Execute+0x18a 1f45aea4 00000001 0042b700 0012fe18 msado15!CRecordset___Open+0x236 0041ae65 00e44a00 cccc0009 cccccccc msado15!CRecordset__Open+0x5ea

Additional query words: AV crash

Keywords: kbbug kbqfe kbmdac260sp2fix kbhotfixserver KB301199

-

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

© Microsoft Corporation. All rights reserved.