[英]Delphi save all values from different datasources with 1 save button
I got this form; 我得到了这张表格;
I want to save al of those edits with 1 save button. 我想使用1个保存按钮来保存所有这些修改。 But the problem is that those fields all have a different datasource.
但是问题在于这些字段都具有不同的数据源。 Is there somebody who can help me out?
有没有人可以帮助我?
Simple go over all data sources involved and use DataSource.DataSet.Post
(assuming the DataSets are already in dsEdit
/ dsInsert
mode). 简单地遍历所有涉及的数据源并使用
DataSource.DataSet.Post
(假设数据集已经处于dsEdit
/ dsInsert
模式下)。
Note: If your DBMS supports transactions, it would be wise to group all your posts in a single transaction, so that data/relations integrity will not be compromised eg: 注意:如果您的DBMS支持事务,明智的做法是将所有帖子归为一个事务,这样就不会损害数据/关系的完整性,例如:
MyConnObj.BeginTrans;
try
DataSource1.DataSet.Post;
DataSource2.DataSet.Post;
DataSource3.DataSet.Post;
MyConnObj.CommitTrans;
except
MyConnObj.RollbackTrans;
raise;
end;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.