PRB: ADO Data Control Events May Generate a Compilation ErrorID: Q222145
|
If you are using the ADO Data Control events in a Visual Basic 6.0 project and you reference ADO 2.1, the following compile error occurs:
The following ADO Data Control Events generate the error if used:Compile Error:
Procedure declaration does not match description of event or procedure having the same name.
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset
NOTE: If no ADO Data Control events are used in the project, no errors will occur.
The ADO 2.1 interfaces have been changed from ADO 2.0. There is no issue with interface changes unless a control is compiled using an older version of ADO. This is the case with the ADO data control. See the MORE INFORMATION section for details.
To make the ADO Data Control events work with ADO 2.1, the declaration of the event has to be changed to include:
ADODB.Recordset20
Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset20)
Please note that the "20" that has been added to ADODB.Recordset in the pRecordset argument.
This behavior is by design.
The ADO Data control is part of Visual Basic 6.0 and was compiled using MDAC 2.0, which was included with Visual Basic 6.0. If you use the ADO data control with MDAC 2.1, you have to keep the project reference pointing to ADO 2.0 because the interfaces changed from 2.0 to 2.1, which is why you see a compile error.
To be able to use the ADO data control with ADO 2.1 would require that the data control be re-compiled. Because the data control is a Visual Basic feature, it won't be re-compiled until the next release of Visual Basic (ADO Data Control doesn't ship with the MDAC stack.) Any time ADO has new added features, the interfaces change and any control built with an older version of ADO only has access to the older interfaces until re-compiled with the newer interfaces.
If you have a machine that had ADO 2.0 and you installed ADO 2.1, you are using ADO 2.1 but you only get the 2.0 interfaces with the ADO Data Control. As a result, what you are going to have is ADO 2.0 type library and ADO 2.1 Object library although the project references still shows both Microsoft ActiveX Data Objects 2.0 Library and Microsoft ActiveX Data Objects 2.1 Library.
Also notice that the file being referenced with ADO 2.0 is:
(C:\Program Files\Common Files\system\ado\msado20.tlb)
while it is (C:\Program Files\Common Files\system\ado\msado15.dll) with ADO2.1.
MsgBox "Hello..."
© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Hussein Abuthuraya, Microsoft Corporation
Additional query words:
Keywords : kbADO200 kbADO210 kbVBp600
Version : WINDOWS:2.1,6.0
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: May 4, 1999