首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

求解,关于检查数据窗口的输入的数据是否重复解决办法

2012-04-16 
求解,关于检查数据窗口的输入的数据是否重复在窗口w_sfzhm中有一数据窗口DW_1,里有其中一个编辑框字段为 s

求解,关于检查数据窗口的输入的数据是否重复
在窗口w_sfzhm中

有一数据窗口DW_1,里有其中一个编辑框
字段为 sfzhm

在哪个对象,哪个事件中写
:当输入的身份证号码回车后跳转到下个输入框之前,如何判断是否已经在表t_info(id,name,sex,sfzhm,phone)
中,如果表有记录则提示"身份证号码已经重复"

[解决办法]
二楼,它说是在表中,而不是在dw中
itemchanged事里面 
if string(dwo.name)='sfzhm' and len(data)>0 then 
select count(*) into : li_row from t_info where sfzhm=:data
if li_row>0 then 
//li_row指定行有,可以用返回值,来控制对其是否再作编辑
 
end if 
end if
[解决办法]
呵呵,走眼了,
不过你的程序还有个BUG,如果是是一个人修改的时候有时候会出错,
应该改为
itemchanged事里面 
string ls_id
if string(dwo.name)='sfzhm' and len(data)>0 then 
ls_id = this.getitemstring(1,'id')//假定id为关键字,且为字符型
if isnull(ls_id) then ls_id=''
select count(*) into : li_row from t_info where sfzhm=:data and id<>:ls_id
if li_row>0 then 
//li_row指定行有,可以用返回值,来控制对其是否再作编辑 

end if 
end if

热点排行