TDocVariantData解析JSON

TDocVariantData解析JSON

var
json: RawUTF8;
doc: TDocVariantData;
i: integer;
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);
doc.InitJSONInPlace(Pointer(json), JSON_OPTIONS_FAST_STRICTJSON);
json := '';
for i := 0 to doc.Count-1 do begin
Memo1.Lines.Add(doc.Values[i].c1);
end;

posted @ 2017-12-16 17:18  delphi中间件  阅读(1232)  评论(0编辑  收藏  举报