Search code examples
delphizeos

Delphi ZeosLib [Incompatible types: 'TZConnection' and 'TZAbstractConnection']


I have a system in Delphi 7 with zeos 6 in which I use the following function:

function zIncCodeByYear (zQry : TZquery; ....): String;
var
  zConLocal, zConOriginal : TZConnection;
  ... 
begin
  bActive := zQry.Active;
  zConOriginal :=  zQry.Connection;

This always worked fine, Now I need to convert this system to Delphi Seatle and, consequently, to Zeos trunk (7.2), after to install this version, in time compile, I get the error:

[dcc32 Error] zeosfuncs.pas(265): E2010 Incompatible types: 'TZConnection' and 'TZAbstractConnection'

What happens? How to get the connection from zquery in this version?


Solution

  • You can simply use ZAbstractConnection and casting to TZConnection does not make a difference for you. Whatever you do is not wrong in this specific case.

    With the help of TZConnection a few properties such as Database, Protocol, ... are being published. In the base class TZAbstractConnection those are public.