Hello,
I am using Delphi 10.4.2.
There is a type library that can be accessed using COM. I can import it and use some parts like login, disconnect, version. There are other parts to do database operations and it seems Delphi has problems using those parts of it.
1- No interface retrieved
var
LQuery: IQuery;
begin
LQuery := FMainConnection.NewQuery();
// Here LQuery still remains as nil
end;
2- Access Violation
var
LInvoice: IData;
LInvoiceLines: ILines
ATime: OleVariant;
begin
LInvoice := FMainConnection.NewDataObject(doSalesInvoice);
try
LInvoice.New();
LInvoice.DataFields.FieldByName('TYPE').Value := 8;
LInvoice.DataFields.FieldByName('NUMBER').Value := 'L0129002';
LInvoice.DataFields.FieldByName('DOC_NUMBER').Value := 'L0129002';
LInvoice.DataFields.FieldByName('AUXIL_CODE').Value := 'AUTO';
LInvoice.DataFields.FieldByName('DATE').Value := '29.01.2022';
FMainConnection.PackTime(12, 12, 12, ATime);
LInvoice.DataFields.FieldByName('TIME').Value := ATime;
LInvoice.DataFields.FieldByName('ARP-CODE').Value := '320.01.002'; // Here Access Violation raises
LInvoiceLines := LInvoice.DataFields.FieldByName('TRANSACTIONS').Lines;
However, If I try all of these using Visual Studio C#.NET, everything works. Since this is COM object, codes on both Visual Studio and Delphi are almost identical.
Both Delphi and Visual Studio installed on my development computer. They are using same Type Library, same dll files and it is only Delphi fails to use its parts.
I wonder if there is some catch to do with Delphi to fix such problems as I am not experienced much using type libraries. Any help is appreciated.
Thanks & Regards,
Ertan