zoukankan      html  css  js  c++  java
  • DataSnap服务器生成的ID自动更新到客户端

    很久没有去动Delphi了,突然兴起做个小程序,一个表的ID,在服务器端的应用服务器上生成,如何刷新到客户端?

    查看了TDataSetProvider的Options属性,比以前增加了一个poPropogateChanges,解释如下:

    Changes made by the server to updated records as part of the update process are sent back to the client and merged into the client dataset.

    代码在服务器端TDataSetProvider的BeforeUpdateRecord事件中,生成ID,如下:

        if UpdateKind = ukInsert then
          DeltaDS.FieldByName('DRUG_INFO_ID').AsInteger:= GetPrimaryKey('T_DRUG_INFO','DRUG_INFO_ID');
       

    客户端ApplyUpdates(0) 后,发现ID仍然没有更新,百思不得其解,后来将AsIneger改成NewValue,一切就好了,真是无语....

      if UpdateKind = ukInsert then
            DeltaDS.FieldByName('DRUG_INFO_ID').NewValue := GetPrimaryKey('T_DRUG_INFO','DRUG_INFO_ID');

  • 相关阅读:
    旅行
    赛道修建
    逃学的小孩
    hdu4035_概率dp
    hdu4405_概率dp
    poj2096_概率dp
    poj3420_找规律+矩阵快速幂
    poj2411_状压dp
    poj3744_矩阵快速幂
    hdu5720_贪心
  • 原文地址:https://www.cnblogs.com/mikemao/p/3145419.html
Copyright © 2011-2022 走看看