首页 > 代码库 > Webservice 返回数据集 DataSet

Webservice 返回数据集 DataSet

一、服务端

New TSoapDataModule

添加控件 TDataSetProvider,TClientDataSet,TADOQuery,TADOConnection

添加方法

function TsoapTest.Getdata(const sql: UTF8String): Variant;
begin
  dm.ADOQuery1.Close;
  dm.ADOQuery1.sql.Text := ‘select top 50 * from mz‘;
  dm.ADOQuery1.Open;
  dm.ClientDataSet1.Data := dm.DataSetProvider1.Data;
  Result := dm.ClientDataSet1.XMLData;
end;

客户端VCL

procedure TForm25.btnGetDataClick(Sender: TObject);
begin
    HTTPRIO1.URL := ‘http://localhost:8080/soap/IsoapTest‘;
  ClientDataSet1.XMLData := (HTTPRIO1 as IsoapTest).Getdata(‘‘);
end;

Android客户端

FireMonkey客户度平台