var
sSql : String;
begin
sSql := ' begin '
adoquery1.sql.add('select * from table1 where field1 ='+''''+'字符串'+'''');
adoquery1.open;
if adoquery1.recordcount>1 then
begin
numcount:=numcount+1;
sSql := sSql + ' Update Table1 set ......';
end;
if adoquery1.recordcount=0 then
begin
adoquery2.fieldbyname('field1').assting:='字符串';
sSql := sSql + ' Insert Table1 Value( ......)';
end;
var CountValue:integer;
with AdoQuery1 do
begin
close;
sql.Clear;
sql.Add('select * from table where 查询条件');
open;
if IsEmpty
then showmessage('符合条件的记录不存在!');
CountValue:=1;
//
close;
sql.clear;
sql.add('insert into 表名 values(....)');
ExecSql;
end;
adoquery1.sql.add('select * from table1 where field1 ='+''''+'字符串'+'''');
adoquery1.open;
if adoquery1.recordcount>1 then
begin
numcount:=numcount+1;
end;
if adoquery1.recordcount=0 then
begin
adoquery2.insert;
adoquery2.fieldbyname('field1').assting:='字符串';
adoquery2.post;