Search code examples
sql-serverdelphidelphi-7delphi-xe

Replace TwwQuery with ADOQuery Delphi XE


We are migrating Delphi 7 applications to Delphi XE. We are replacing BDE database component with ADO .In Delphi 7 application we have heavily used TwwQuery (Info Power) component. Though TwwQuery is only supported by BDE ,we have to replace TwwQuery with ADOQuery.We have around 20 + application to migrate and going to all TwwQueries and replace them manually is very time consuming. Is there any code or script which can replace all the TwwQuery to ADO Query?


Solution

  • I am not aware of an existing script or library that will do exactly what you want but it shouldn't be too difficult to write one yourself. The basic theory would be something like this:

    • Load the contents of the DFM and PAS source files as text.
    • Scan through looking for instances of TwwQuery.
    • Replace the definition of the component with TADOQuery.
    • Update each query's properties with the ADO equivalents (I believe they are fairly similar though).
    • Save the file.

    Obviously there's a bit of trial and error involved in getting it exactly right but once you have done it should work for all of your applications.