소스가 아래와 같은뎅... 에러가 나더라구여!!!
어느부분이 틀렸는지 좀 갈켜주시면 감사하겠습니당. ^^
procedure Tfrm_sawoninput.BinsertClick(Sender: TObject);
begin
Query1.Close;
Query1.SQL.Clear;
Query1.SQL.Add(' select * from sawon where S_NO = :S_NO ');
Query1.ParamByName('S_NO').AsInteger := strtoint(sabun1.Text);
Query1.Open;
if Query1.RecordCount = 0 then
begin
Query2.Close;
Query2.SQL.Clear;
Query2.SQL.Add(' insert into sawon ');
Query2.SQL.Add(' (S_NO,S_NAME,S_LEVEL,S_RICH,S_SDAY) ');
Query2.SQL.Add(' values(:S_NO,:S_NAME,:S_LEVEL,:S_RICH,:S_SDAY) ');
Query2.ParamByName('S_NO').AsInteger := strtoint(sabun1.Text);
Query2.ParamByName('S_NAME').AsString := sawonname.Text;
Query2.ParamByName('S_LEVEL').AsInteger := strtoint(jikub.Text);
Query2.ParamByName('S_RICH').AsInteger := strtoint(hobong.Text);
Query2.ParamByName('S_SDAY').AsInteger := strtoint(indate.Text);
Query2.Open;
showmessage('등록되었습니다.');
end
else
begin
showmessage('이미 등록된 사원입니다.');
sabun1.Text := inttostr(Query1.FieldByName('S_NO').AsInteger);
sawonname.Text := Query1.FieldByName('S_NAME').AsString;
jikub.Text := inttostr(Query1.FieldByName('S_LEVEL').AsInteger);
hobong.Text := inttostr(Query1.FieldByName('S_RICH').AsInteger);
indate.Text := inttostr(Query1.FieldByName('S_SDAY').AsInteger);
end;
end;
end.
Query2.ExecSql; <--요렇게 해 보셈~
구럼 즐코~
미여니 wrote:
> 소스가 아래와 같은뎅... 에러가 나더라구여!!!
> 어느부분이 틀렸는지 좀 갈켜주시면 감사하겠습니당. ^^
>
>
> procedure Tfrm_sawoninput.BinsertClick(Sender: TObject);
> begin
> Query1.Close;
> Query1.SQL.Clear;
> Query1.SQL.Add(' select * from sawon where S_NO = :S_NO ');
> Query1.ParamByName('S_NO').AsInteger := strtoint(sabun1.Text);
> Query1.Open;
>
> if Query1.RecordCount = 0 then
> begin
> Query2.Close;
> Query2.SQL.Clear;
> Query2.SQL.Add(' insert into sawon ');
> Query2.SQL.Add(' (S_NO,S_NAME,S_LEVEL,S_RICH,S_SDAY) ');
> Query2.SQL.Add(' values(:S_NO,:S_NAME,:S_LEVEL,:S_RICH,:S_SDAY) ');
> Query2.ParamByName('S_NO').AsInteger := strtoint(sabun1.Text);
> Query2.ParamByName('S_NAME').AsString := sawonname.Text;
> Query2.ParamByName('S_LEVEL').AsInteger := strtoint(jikub.Text);
> Query2.ParamByName('S_RICH').AsInteger := strtoint(hobong.Text);
> Query2.ParamByName('S_SDAY').AsInteger := strtoint(indate.Text);
> Query2.Open;
> showmessage('등록되었습니다.');
> end
> else
> begin
> showmessage('이미 등록된 사원입니다.');
> sabun1.Text := inttostr(Query1.FieldByName('S_NO').AsInteger);
> sawonname.Text := Query1.FieldByName('S_NAME').AsString;
> jikub.Text := inttostr(Query1.FieldByName('S_LEVEL').AsInteger);
> hobong.Text := inttostr(Query1.FieldByName('S_RICH').AsInteger);
> indate.Text := inttostr(Query1.FieldByName('S_SDAY').AsInteger);
> end;
> end;
>
>
> end.