FIREDAC调用中间件远程方法查询数据示例
服务端使用FDQUERY查询数据并返回TDATASET:
function TServerMethods1.GetData(var sql: string): tdataset;
begin
qry.Close;
qry.Open(sql);
Result := TFDMemTable.Create(nil);
TFDMemTable(Result).Data := qry.Data;
end;
客户端用FDCONNECTION连接中间件,FDStoredProc访问远程方法:
procedure TForm1.Button1Click(Sender: TObject);
begin
FDConnection1.Connected := true;
FDStoredProc1.Close;
FDStoredProc1.Unprepare;
FDStoredProc1.StoredProcName := 'TServerMethods1.GetData';
FDStoredProc1.Prepare;
FDStoredProc1.ParamByName('sql').Value := 'select * from bas_goods';
FDStoredProc1.open;
FDMemTable1.Close;
FDMemTable1.Data := FDStoredProc1.Data;
FDStoredProc1.Close;
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/3973864.html