TynSerial序列(還原)TFDMemTablesql
1)TFDMemTable查詢數據url
procedure TForm1.Qrys(accountno, sql, sql2: string; DataSet, DataSet2: TFDMemTable); // TFDMemTable主從表查詢 var url: SockString; i: integer; serial: TynSerial; begin serial := TynSerial.Create; try url := 'querys'; serial.WriteString('accountno', accountno); serial.WriteString('sql', sql); serial.WriteString('sql2', sql2); i := FHttp.Post(url, serial.Text, FDataType); if i = 200 then begin serial.Text := FHttp.Content; serial.ReadFDDataSet('dataset', DataSet); serial.ReadFDDataSet('dataset2', DataSet2); end else ShowMessage(i.ToString + ' error'); finally serial.Free; end; end;
2) TFDMemTable提交數據orm
function TForm1.Save(accountno, tablename: string; dataset: TFDMemTable): string; // TFDMemTable提交 var url: SockString; i: Integer; serial: TynSerial; begin serial := TynSerial.Create; try url := 'save2'; serial.WriteString('accountno', accountno); serial.WriteString('tablename', tablename); serial.WriteFDDelta('delta', dataset); i := FHttp.Post(url, serial.Text, FDataType); if i = 200 then begin serial.Text := FHttp.Content; if serial.ReadBool('result') then dataset.MergeChangeLog else ShowMessage('提交失敗'); end else ShowMessage(i.ToString + ' error'); finally serial.Free; end; end;