adoquery.close; adoquery.sql.add('select * from table1 where id='''+edit.text+''''); adoquery.open if adoquery.recordcount>=0 then begin showmessage('记录已经存在'); end;
adoquery.close; adoquery.sql.add('select * from (select distinct(id) As id, count(1) As ShuLiang from table1 ) aa where shuliang >1 '); adoquery.open
我的方法 adoquery1.close; adoquery1.sql.clear; adoquery1.sql.add('select * from yourtable where yourfield = '+edit.text+''); if adoquery1.recordcount>1 then showmessage('数据重复!');
adoquery.sql.add('select * from table1 where id='''+edit.text+'''');
adoquery.open
if adoquery.recordcount>=0 then
begin
showmessage('记录已经存在');
end;
adoquery.sql.add('select * from (select distinct(id) As id, count(1) As ShuLiang from table1 ) aa where shuliang >1 ');
adoquery.open
adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * from yourtable where yourfield = '+edit.text+'');
if adoquery1.recordcount>1 then
showmessage('数据重复!');