Home > Back-end >  Methods three layer how to invoke a custom database
Methods three layer how to invoke a custom database

Time:10-06

Server: to establish a Remote Data Module, the name of the class F_AServer
One way to custom
The function GetRecord (const Sql: WideString) : OleVariant; Safecall;
Returns the DataSetProvider. Data

Client:
Call GetRecord
The client added a DataMoule, name F_DM, drag and drop a DCOM controls name as con1,
A ClientDataSet control, the name for the ds1,
Put a button, the button event as follows: (calling server-side GetRecord method)
Procedure TForm1. Btn_1Click (Sender: TObject);
Var
Obj: IF_AServer;
The begin
Obj:=CoF_AServer (DM) F_DM) con1. GetServer). The Create;
DM. F_DM. Ds1. Data:=obj. GetRecord (' select * from hy_info ');
end;

Tip the server unexpected situation, how to call server-side method???

CodePudding user response:

Procedure TForm1. Btn_1Click (Sender: TObject);
The begin
DM. F_DM. Con1. Open;
DM. F_DM. Ds1. Data:=DM. F_DM. Con1. AppServer. GetRecord (' select * from hy_info ');
end;

Debugging, found the call GetRecord method, the parameter is not passed to the server, the server to get the string parameter='
, if there is no string parameters, if I were in the service side assignment parameters, return OleVariant, client suggest Unsigged,
Assigned to ClientDataSet, appear InValid Data Packet

CodePudding user response:

http://bbs.csdn.net/topics/380125338 to see the brothers
  • Related