• 远程方法的定义和调用


    xe datasnap自动支持TParams对象的序列,无需我们手动序列,真的很方便。

    远程方法定义示例:

    function TServerMethods1.GetData(sql: string;
      params: TParams): TDataSet;
    begin
      cds.Close;
      cds.CommandText := '';
      cds.CommandText := sql;
      cds.Params.Clear;
      cds.Params := params;
      cds.Open;
      Result := cds;
    end;

    客户端远程调用示例:

    function TMySQL.GetData: TDataSet;
    begin
      fSqlMethod.ServerMethodName := 'TServerMethods1.getData';
      fSqlMethod.ParamByName('sql').AsString := fSqlcommand;
      fSqlMethod.ParamByName('params').AsParams := fQry.Params;
      fSqlMethod.ExecuteMethod;
      Result := fSqlMethod.ParamByName('returnparameter').AsDataSet;
    end;

  • 相关阅读:
    [HDOJ3567]Eight II
    [HDOJ3622]Bomb Game
    HTML 5 音频
    下拉菜单
    固定导航及右侧固定广告
    隔行换色
    返回顶部
    HTML 5 视频
    TAB切换
    自我介绍
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2347693.html
Copyright © 2020-2023  润新知