很久没有去动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');

相关文章:

  • 2022-02-08
  • 2021-12-30
  • 2021-12-21
  • 2021-06-16
  • 2021-10-05
  • 2022-12-23
  • 2021-07-10
  • 2021-08-02
猜你喜欢
  • 2021-11-01
  • 2022-12-23
  • 2021-11-10
  • 2021-09-16
  • 2021-09-15
  • 2022-12-23
相关资源
相似解决方案