如果要求此字段不重复,可在DBEDIT的ONEXIT中加入;
QUERY1.CLOSE;
QUERY1.SQL.CLEAR;
QUERY1.SQL.ADD('SELECT 字段 FROM TABLE WHERE 字段=:XX‘);
QUERY1.PARAMSTRBYNAME('XX'):=TRIM(DBEDIT1.TEXT);
QUERY1.OPEN;
IF QUERY.RECORDCOUNT>0 THEN
BEGIN
MESSAGEBOX('记录重复’);
DBEDIT1.SETFOCUS;
END;