Sql.Add('select username from table where username=:a');
Parmas[0].AsString:=Name;//Name 为要判断的用户名
Open
if Eof then
ShowMessage('不存在')
else
ShowMessage('存在');
Parmas[0].AsString:=Name;//Name 为要判断的用户名
Open
if Eof then
ShowMessage('不存在')
else
ShowMessage('存在');
select counts(name) from table1
select counts(distinct name) from table1
取出两个值比较就行了!
用Table组件怎么做
用两个table连接同一个表,一个定位,另一个对前一table定位的记录进行过滤,如果有一个以上的记录,说明有重复!
table1.first;
while not table1.eof do
begin
table2.filter:='name='''+table1.fieldbyname('name').asstring+'''';
if talbe2.recordcount>1 then
showmessage('存在');
end;