Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading adodb.recordset from vb6 activex dll in Delphi 1

Status
Not open for further replies.

TNB

Programmer
Dec 11, 2001
4
DK
I have created an activex dll in visual basic 6. The Activex returns in a procedure an adodb.recordset.

This recordset causes problems to read from Delphi 5. The other activex functions and procedures passing strings and numbers works perfect in Delphi.

What is the correct syntax for passing this adodb.recordset succesfully? Should the visual basic activex pass a adodb.recordset or a variant? On the other hand should Delphi declare dataset.recordset (fails on compile in delphi),a _recordset (fails on compile in Delphi) or a olevariant to handle the recordset from the activex (fails when accessing fx. fieldcount)?

Thanks in advance!

Thomas Bak

 
Howdy,

To get it to work, you need to declare a variable of OLEVariant type. Then in your code, you have to also initialise that variable as an ADO Recordset object. After that you should be able to assign the recordset from your dll into your variable.

Try the following : (assuming 'GetRecObj' is your external function)

uses ComObj;

var
ADORec : OLEVariant;
FCount : Integer;
begin
ADORec := CreateOLEObject('ADODB.Recordset');
ADORec := GetRecObj;
FCount := ADORec.FieldCount;
...
...
...
end;

Hope this helps
WB
 
Great!!! It works now!!

The adodb.recordset had to be declared as a variant in my vb ActiveX as well. After that your Delphi code example worked perfectly.

Thanks a lot!

Thomas Bak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top