hi,
I have the following code wich is raising an EConvertError - "can not assign TAdoConnection to TAdoConnection"
var
wTmpADOConn : TADOConnection;
begin
//
Result := nil;
try
Result := TADOConnection.Create(nil);
wTmpADOConn := afunc(aNameConn);//aFunc-Function which returns a pointer to a TADOConnection object, aNameConn - string- the name of connection
if wTmpADOConn <> nil then
begin
Result.Assign(wTmpADOConn);//here the error is raising
I can not understand what I'm doing wrong. I've tried to cast to TAdoConnection or TPersistent the variable wTmpADOConn, but without success.
I know that for copying an object it can be used the Assign procedure.
Code is written in Delphi 7.
LE: thank you all, the problem is that the object is a shared object, is a reference to another ADOConnection. And I want my own object so i can free it, without freeing the reference. The logic is complex, and I need some mechanism to create an object from that reference.
Thanks in advance!
Best regards,