• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Passing Dataset from a Com Object to client

Hi,
 I need to pass a dataset (Tdataset) that I have created in a COM object as  shown below

function TMessageBoard.getCustomerList: OleVariant;
var
  dbconn1 : Tdatabase;
  custData : TStoredProc;
  myxml : conxml ;
  rstr : String;
begin

     custData := omnidm.OmniConn;

    custData :=  TStoredProc.Create(nil)  ;
    custData .DatabaseName := dbconn1 .DatabaseName;
    custData .StoredProcName :=   'sp_getCustomerList';
    custData .Prepare;
    custData .Open;

   
    Result := myproc1;

end;

I get a type mismatch error .

Is it possible to pass Datasets ,if so What should be the return datatype ?

I am using delphi 6.0. currently I am passing data as Variant Arrays .

Regards
Ganesh
0
nayakga
Asked:
nayakga
1 Solution
 
Lee_NoverCommented:
you need to pass it to what ?
if to another delphi app then I suggest you use TClientDataSet
the data "is in" Data property as OleVariant :)
so in the COM server you export the data like :

function TMessageBoard.getCustomerList: OleVariant;
begin
   Result := ClientDataSet.Data;
end;


and btw .. what sense does this have :
   custData := omnidm.OmniConn;
   custData := TStoredProc.Create(nil);


a better solution would be to creata a RemoteDataModule
(New > MultiTier > Remote Data Module - DataSnap package must be loaded)
then on the client put a DataSnap connection component (DCOM, Socket, ...) and a ClientDataSet
set the clientdatasets RemoteServer property to the connection component
then select the provider
works nicely :)

for more info check the $Delphi\Demos\Midas\ folder for examples
0
 
ZencovichCommented:
Try use TADOCOnnection/TADODataSet instead and pass
TADOConnection._Connection and TADODataSet._RecordSet property values.
In host/client application you may set this properties to your own TADODataSet and get access to COM's dataset.

In DCOM configuration you may need set RDSConnection too.

0
 
CleanupPingCommented:
nayakga:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
snehanshuCommented:
Hi!
No comment has been added lately and this question is therefore classified abandoned.

If asker wishes to close the question, then refer to
http://www.experts-exchange.com/help/closing.jsp

Otherwise, I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: Lee_Nover

Please leave any comments here within the next seven days. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

...Snehanshu
EE Cleanup Volunteer
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now