其他分享
首页 > 其他分享> > mORMot学习笔记3 数据集转Json

mORMot学习笔记3 数据集转Json

作者:互联网

uses
SynCommons, SynDB, SynOleDB;

procedure TForm1.DataToJsonClick(Sender: TObject); var Conn: TOleDBMSSQLConnectionProperties; strSql: string; rows: ISQLDBRows; strStream: TStringStream; begin Conn := TOleDBMSSQLConnectionProperties.Create('127.0.0.1', 'Northwind', 'sa', 'Sa123'); strSql := 'SELECT EmployeeID,LastName,FirstName,Title FROM Employees'; strStream:=TStringStream.Create('',TEncoding.UTF8); try rows := Conn.ExecuteInlined(strSql, True); rows.FetchAllToJSON(strStream, True); Memo1.Text := strStream.DataString; finally strStream.Free; end; end;

标签:rows,end,集转,Create,mORMot,Json,strSql,strStream,Conn
来源: https://www.cnblogs.com/win32pro/p/11665945.html