咏南中间件新增MORMOT移动端演示
基于FMX,支持安卓、IOS移动端。
1)使用INDY 的HTTP控件进行查询:
procedure TForm1.查询1Click(Sender: TObject);
begin
var url: TynUrl := TynUrl.Create;
var serial: TynSerial := TynSerial.Create;
var send: TMemoryStream := TMemoryStream.Create;
try
url.url := 'http://127.0.0.1:5566';
url.command := 'query8';
url.params.Add('accountno=1');
url.params.Add('sql=select * from tunit');
serial.Text := IdHttpClient1.Post(url.text, send);
serial.ReadFDDataSet('dataset', FDMemTable1);
finally
serial.Free;
send.Free;
url.Free;
end;
end;
2)使用DELPHI10.2新增的TNetHttpClient控件进行查询:
procedure TForm1.查询2Click(Sender: TObject);
begin
var url: TynUrl := TynUrl.Create;
var serial: TynSerial := TynSerial.Create;
var send: TMemoryStream := TMemoryStream.Create;
try
url.url := 'http://127.0.0.1:5566';
url.command := 'query8';
url.params.Add('accountno=1');
url.params.Add('sql=select * from tunit');
serial.Text := NetHttpClient1.Post(url.text, send).ContentAsString;
serial.ReadFDDataSet('dataset', FDMemTable1);
finally
serial.Free;
send.Free;
url.Free;
end;
end;