是否有可能在delphi数据集中创建假数据字段?

编程入门 行业动态 更新时间:2024-10-18 14:18:25
本文介绍了是否有可能在delphi数据集中创建假数据字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在数据集(不是ClientDataSet)中创建一个假数据字段:

I want to create a 'fake' data field in a DataSet (not ClientDataSet):

  • 该字段不应存储在db
  • 这不是计算字段(应该允许用户输入输入数据)
  • 该字段具有业务逻辑含义,因此在用户更新其值,应该更新其他字段(使用OnFieldChange事件)

我知道我可以拥有一个简单的无垃圾邮件控件,捕获它的OnChange事件并在那里执行计算(或调用DataSet所在的DataModule函数),但我认为如果我可以重新利用带有db-ware控件和数据集事件的数据集自动绑定,那就更干净了。.

I know I can have a simple no-dbaware control, capture it's OnChange event and perform the calculations there (or call a DataModule function, where the DataSet resides) but I think it's more clean if I can reutilize the dataset automatic binding with db-ware controls and dataset events..

通过这种方式,Form(演示文稿)与DataModule(模型)之间的唯一连接就是DataSet(较少耦合)。

Also this way the unique connection between the Form (Presentation) and the DataModule (Model) it's the DataSet (less coupling)..

PD:我正在使用fibplus,我认为解决方案(如果有)将在VCL级别上。

PD: I'm using fibplus, with I think the solution (if any) will be at the VCL level..

谢谢!

推荐答案

您是否尝试过使用InternalCalc字段?数据感知控件将允许您编辑InternalCalc字段的值,并将该值存储在数据集中。

Have you tried using an InternalCalc field? Your data aware controls will let you edit an InternalCalc field's value, and the value is stored in the dataset.

如果您在数据集中创建了InternalCalc字段(TClientDataSet,TQuery等),这几乎正是您要的。

If you create an InternalCalc field in the dataset (TClientDataSet, TQuery, etc.) at design time, it's almost exactly what you're asking for.

更多推荐

是否有可能在delphi数据集中创建假数据字段?

本文发布于:2023-11-13 14:49:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584623.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   有可能   字段   delphi

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!