사원번호 중복을 체크하여 같은 번호가 입력되지 않게 하기위한것인데 ...
실행시키면 사원번호가 다같다고 나오거든요.....
좀 도와 주세요!!!!
procedure TFPinsa.scodeKeyPress(Sender: TObject; var Key: Char);
var
s:string;
begin
if Key = #13 then
begin
SelectNext(Sender As TWinControl, True, True);
Key := #13;
s:= fdm.tperson.fieldbyname('scode').asstring;
////////////////////////////////////////같은 사원번호가 안나오게 하기위하부분...
with fdm.tperson do
begin
if scode.text = s then
begin
showmessage('다시 입력해주세요');
scode.setfocus;
end
else if scode.text <> s then
begin
irum.setfocus;
end;
end;
end;
end;
> 사원번호 중복을 체크하여 같은 번호가 입력되지 않게 하기위한것인데 ...
> 실행시키면 사원번호가 다같다고 나오거든요.....
> 좀 도와 주세요!!!!
>
> procedure TFPinsa.scodeKeyPress(Sender: TObject; var Key: Char);
> var
> s:string;
> begin
> if Key = #13 then begin
> SelectNext(Sender As TWinControl, True, True);
> Key := #13;
s:= 사원번호.Text;
with fdm.tperson do begin
close;
sql.clear;
sql.add('select 사원번호필드명 from 인사디비');
sql.add('where 사원번호필드명 = :사원법호');
prambyname('사원번호').asstring := s;
if RecordCount > 0 then begin
showmessage('사원번호가 이미 있당. 다시 입력해주세요');
사원번호.SetFocus;
Exit;
end else
irum.setfocus;
end;
end;
end;