如题,测试了一下使用tdbxjsontools.tabletojson函数,第一个参数如果如下写法acommand.executequery那么显示
function TServerMethods1.getData: string;
var
acommand:tdbxcommand;
areader:TDBXReader;
begin
result:='';
self.SQLConnection1.open;
//self.SQLConnection1.Params['database'].t
acommand:=self.SQLConnection1.DBXConnection.CreateCommand;
//acommand:=webmoduleunit1
acommand.Text:='select id,firstname,lastname from tblist';
acommand.Prepare;
areader:=acommand.ExecuteQuery;
result:=tdbxjsontools.TableToJSON(acommand.ExecuteQuery,10,true).ToString;
//result:=tdbxjsontools.TableToJSON(areader,8,true).ToString;
acommand.Free;
//areader.Free;
end;
[dcc32 Error] ServerMethodsUnit1.pas(50): E2033 Types of actual and formal var parameters must be identical。
只能先把sql查询结果赋值给areader,然后再用这个函数,就正常了。
百思不得其解。