用户表名为login:
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select count(*) as jc from login where id='#39+zcedt1.Text+#39'');
try
ADOQuery1.Open;
if StrToInt(ADOQuery1.FieldValues['jc'])>0 then
begin
ShowMessage('该用户名已存在!');
Exit;
end
except
end;