You are not logged in.
Pages: 1
Hi everyone, I'am new with mormot. I want to know what should i do to view string field in a dbgrid?
Below is my coding:
FPropsPostgreSQL:= TSQLDBZEOSConnectionProperties.Create
(TSQLDBZEOSConnectionProperties.URI (dPostgreSQL, '192.168.0.1:5432'),
'mydatabase', 'user', 'password');
ds01.DataSet.Free;
ds01.DataSet:= ToDataSet (ds01,
FPropsPostgreSQL.Execute ('select * from mytable', []));
The record is shown but all string fields is showing with chinese character...
Am I missing something?
Thank you in advanced.
Offline
Sorry, i just found the solution from other post:
var
s: RawUTF8;
sResultJSON: UTF8String;
mystmt: TSQLDBStatement;
myTable: TSQLTable;
FPropsPostgreSQL:= TSQLDBZEOSConnectionProperties.Create
(TSQLDBZEOSConnectionProperties.URI (dMySQL, '192.168.0.1:3306'),
'mydatabase', 'user', 'password');
ds01.DataSet.Free;
s:= 'select * from mytable';
try
FPropsPostgreSQL.ThreadingMode:= tmMainConnection;
FPropsPostgreSQL.MainConnection.Connect;
try
mystmt:= FPropsPostgreSQL.NewThreadSafeStatement;
mystmt.Prepare (s, True);
mystmt.ExecutePrepared;
sResultJSON:= mystmt.FetchAllAsJSON (True);
finally
mystmt.Free;
end;
myTable:= TSQLTableJSON.Create ('', sResultJSON);
ds01.DataSet:= TSynSQLTableDataSet.Create (Self, myTable);
finally
end;
But i am still curious, is there any faster method of doing this?
Thank you.
Offline
Pages: 1