如何在编号字段输入时判断它是否已经存在?(100分)

  • 主题发起人 xyt3dnow
  • 开始时间
X

xyt3dnow

Unregistered / Unconfirmed
GUEST, unregistred user!
如何在编号字段输入时判断它是否已经存在?用什么语句进行检索?
 
if exists(Select id from table where id=你的编号)
 
用Locate语句﹕
例﹕
if Dm.Aperson.Locate(‘Emp_id’,trim(Dbedit1.text),[]) then
ShowMessage(‘This Emp_id is already in this table’)
Else
ShowMessage(‘The Table havn’t this Emp_id’)
End;
 
同意楼上
 
接受答案了.
 
顶部