자꾸 쉬운것만 물어보네요..(아구 어려버..!)
DBGrid에서 선택된 레코드를 지우려고 합니다.
DBGrid에서 클릭하면 FieldByName으로 Edit1.Text에 입력하구요..
SQL.Add에서 Edit1.Text값을 삭제하면....!
DB내에서 동일한 이름의 데이터가 모두다 삭제가 되어버립니다.
그리고 에러가 납니다...
어떻게 된걸까요...!
[소오스...]
If MessageDlg('선택하신 레코드를 정말로 삭제합니다',mtConfirmation, [mbOk, mbCancel],0) = mrOk Then
begin
With Query2 do begin
Active := False;
SQL.Clear;
SQL.Add('Delete From Jangbu Where Kwan =:Kwan');
ParamByName('Kwan').AsString := Edit1.Text;
ExecSQL;
Active := True;
Last;
end;
end;
[에러내용]
Project Kidhouse.exe raised exception class ENoResultSet with message 'Error creating cursor handle'. Process stopped. Use Step or Run to Countinue.
With Query2 do begin
> close; <- 요렇게 바꿈
> SQL.Clear;
> SQL.Add('Delete From Jangbu Where Kwan =:Kwan');
> ParamByName('Kwan').AsString := Edit1.Text;
> ExecSQL;
> //Active := True; <- 지움
> //Last; <- 지움
> end;
쿼리를 쓸때 refresh 나 active가 잘 안 먹더라고요.
그래서 전 프러시져를 하나 만들어서 qurey를 다시 던져
refresh 역할을 하게 만듭니다.(넘 허접한 방법인가?? --;)
그리고 동일 이름의 내용이 지워졌다는 말은 무슨 의미 인지 모르겠군요.
일단적으로 delete 할때는 where 조건에 대개 pk값을 집어 넣기는 하는데
(pk의 값은 유일한 하나의 값이므로..)
원하는 결과가 안 나온다는 건지, 결과는 맞다는 건지 모르겠군요.
그냥 참조 하세요
이지컴 wrote:
>
> 자꾸 쉬운것만 물어보네요..(아구 어려버..!)
> DBGrid에서 선택된 레코드를 지우려고 합니다.
> DBGrid에서 클릭하면 FieldByName으로 Edit1.Text에 입력하구요..
> SQL.Add에서 Edit1.Text값을 삭제하면....!
> DB내에서 동일한 이름의 데이터가 모두다 삭제가 되어버립니다.
> 그리고 에러가 납니다...
> 어떻게 된걸까요...!
> [소오스...]
> If MessageDlg('선택하신 레코드를 정말로 삭제합니다',mtConfirmation, [mbOk, mbCancel],0) = mrOk Then
> begin
> With Query2 do begin
> Active := False;
> SQL.Clear;
> SQL.Add('Delete From Jangbu Where Kwan =:Kwan');
> ParamByName('Kwan').AsString := Edit1.Text;
> ExecSQL;
> Active := True;
> Last;
> end;
> end;
> [에러내용]
> Project Kidhouse.exe raised exception class ENoResultSet with message 'Error creating cursor handle'. Process stopped. Use Step or Run to Countinue.