mormot数据库连接+查询+序列为JSON
mormot数据库连接+查询+序列为JSON
uses SynDB,SynCommons, SynDBRemote, SynOleDB, SynDBMidasVCL, mORMotMidasVCL
procedure TForm1.FormCreate(Sender: TObject);
var
json: RawUTF8;
begin
DataBase := TOleDBMSSQLConnectionProperties.Create('127.0.0.1,8829', 'yndb', 'sa', 'sa');
// DBServer := TSQLDBServerHttpApi.Create(DataBase, 'jj', '6789', 'admin', 'admin', False, 8, nil, tmThreadPool);
qry:=TQuery.Create(DataBase.ThreadSafeConnection);
qry.Close;
qry.SQL.Clear;
qry.SQL.Add('select top 100 * from t2');
qry.Open;
json := qry.PreparedSQLDBStatement.FetchAllAsJSON(True);
qry.Free;
DataSource1.DataSet := JSONToClientDataSet(Self, json);
end;
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/8047031.html