have you done :-
rsoldOrders :=createOLEObject('ado.recordset') ??
problem is, that "rsoldOrders " needs to be assigned to a Recorset object.
I have code at home for this, (delphi code) can you wait till then ??
Jeremy Coulter
Application Developer
Application Development Centre
Compaq Computer New Zealand Ltd.
Phone: 64 3 371 5724 (DD)
Fax: 64 3 371 5744
Cell: 021 2150435
E-mail: [EMAIL PROTECTED]
Private E-Mail: [EMAIL PROTECTED]
-----Original Message-----
From: Chris Crowe [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 03, 1999 10:32
To: Multiple recipients of list delphi
Subject: [DUG]: ADO Hierarchial Record Sets
Below is a simple ADO application which uses Hirarchial Record sets. I can
not get it to work. In VB you use a syntax like the following to get access
to the child record set.
Set rsTitle = rsPub!rsOldOrders.Value
So in Delphi I tried
rsoldOrders := rsPub.Fields['rsOldOrders'].Value;
But it will not compile with the error "Incompatible types OLEVariant and
_Recordset"
Does anyone have any ideas here?
Chris
Christopher Crowe (Software Developer)
Microsoft MVP, MCP
Adrock Software
Byte Computer & Software LTD
P.O Box 13-155
Christchurch
New Zealand
Phone/Fax (NZ) 03-3651-112
==================================
unit AdoSample;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
adodb_tlb,
StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
ListBox1: TListBox;
Panel1: TPanel;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
Var
ADOSql : String;
cn : Connection;
rsOldOrders,
rsPub : Recordset;
rsTitle : Recordset;
rsRecent : Recordset;
SQL : String;
begin
Cn := CoConnection.Create;
cn.Provider := 'MSDataShape';
cn.Open ('dsn=OLE_access_NWIND','','',0);
rsPub := CoRecordset.Create;
rsOldOrders := CoRecordset.Create;
ADOSql := 'SHAPE {SELECT * FROM customers} '+
'APPEND ({SELECT * From orders Where orderdate < #1/1/1996# And
customerid = ?} '+
'RELATE customerid TO PARAMETER 0) AS rsOldOrders, '+
'({SELECT * From orders WHERE orderdate >= #1/1/1996#} '+
'RELATE customerid TO customerid) AS rsRecentOrders ';
rsPub.Open(ADOSql, cn, adOpenStatic, adLockReadOnly, adCmdText);
ListBox1.items.Clear;
While (rsPub.EOF= FALSE) do
begin
ListBox1.items.Add('Customer = '+rsPub.Fields['CompanyName'].Value);
rsoldOrders := rsPub.Fields['rsOldOrders'].Value;
While (rsoldOrders.EOF= FALSE) do
begin
ListBox1.items.Add('
'+rsOldOrders.Fields['OrderDate'].Value);
rsOldOrders.Movenext
end;
rsOldOrders.Close;
rsPub.moveNext;
end;
rsPub.Close;
end;
end.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
Jeremy Coulter.vcf