验证重复数据(添加和编辑) [英] Validation of duplicate data (add and edit)

查看:80
本文介绍了验证重复数据(添加和编辑)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表中的示例记录(在gridview中查看)

example records in my tables (view in gridview)

POSITION         LASTNAME

CHAIRMAN        REYES
MEMBER          LUNA
MEMBER          MARTINEZ

ADD BUTTON
EDIT BUTTON



当我编辑主席时,由于验证,我无法保存它,因为该字段中必须只有一位主席才能显示该主席.

我要保存下来,他仍然是董事长吗?

谢谢!



When I edit the chairman, I can''t save it because of the validation, that there must be only one chairman in the field shows it.

How can I save this, that he is still the chairman?

Thanks!

推荐答案

在验证检查中,您还需要添加一个条件,即如果当前记录是先前的现有记录,则将其忽略.

通常在数据库级别,这是通过密钥来处理的.
在用户界面级别,您可以存储当前主席.在进行编辑和更新时,只需比较一下,看一次编辑是否是现任主席-如果是,请不要重复检查,而只是继续进行.

最重要的是,您需要跟踪当前的主席并相应地处理验证部分.
In the validation check you need to include one more condition that if the current record is the previous existing one itslef then ignore.

Generally at DB level, this is handled via a key.
At UI level, you can store the current chairman. When editing and updating, just compare and see if the one editing is of current chairman or not - if so, don''t put the duplicate check and just move ahead.

Bottom line, you need to keep track of current chairman and accordingly handle the validation part.


这篇关于验证重复数据(添加和编辑)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆