Swagman9203
Swagman9203

Reputation: 21

F2051 Unit ADODB was compiled with a different version of ADOInt._Command

I've inherited some Delphi 7 code and I'm trying to migrate to Delphi 2010. I've gone through all the forms and code updating where necessary but when I try to run I get the message in the title above. I have 4 access database files that are queried by the program. I have opened these up in MS Access 2013 and they all look OK. Interestingly when I created a new project and added the same ADO components the data displayed in the grids just fine. I have tried the various options listed on the forum associated with F2051 error but to no avail. Can anybody suggest where I may be going wrong. Bright thoughts.

Tony

Upvotes: 0

Views: 537

Answers (1)

Deltics
Deltics

Reputation: 23036

Check the project source (DPR) and/or settings of the migrated application project.

You may find explicit entries in the uses list that reference ADO units that are normally part of the VCL/RTL.

Or, you may find the relevant ADO*.pas files have been placed in the same location as the DPR file itself.

Alternatively you may find these units in a location that is referenced in the project search path.

Either way, the issue is most likely the result of the older project having taken units from the VCL source code and placed them in a project specific location in order to allow changes to be made to those units. This is a technique for fixing bugs in VCL units which works as long as the interface of the units is not modified and/or all dependent units are similarly recompiled.

The interface section of a unit determines how other units are linked to it, and if you change that interface then the linkage to those other units is broken. If those other units can be recompiled then this is resolved, but in the case of VCL units it often leads to these problems since those other units typically are not recompiled.

Once you have identified the changed VCL units involved in your project, you should then compare the changed versions with the versions that are provided with the later compiler (Delphi 2010). You may find that the changes in the Delphi 7 project were to fix bugs that are now fixed in the standard VCL versions of the units, in which case you can remove the modified ADO VCL units from the project and simply use the VCL versions.

Or, you may find that the changes made in the Delphi 7 units need to be ported to the Delphi 2010 versions, in which case you should replicate the project organisation that allows the involved units to be recompiled in your Delphi 2010 project using the Delphi 2010 units, and then merge the changes from the Delphi 7 versions into those Delphi 2010 units:

Delphi 7 original.pas            Delphi 2010 original.pas

      ^                                      \
    diff  --------------------------------> port
      v                                       _\|

Delphi 7 modified.pas                   Delphi 2010 modified.pas

Note that if the Delphi 2010 original version differs from the Delphi 7 original then you must be careful to port those changes that are needed by your project without undoing other fixes and without affecting the interface of the modified units.

Upvotes: 3

Related Questions