B
babyrun
Unregistered / Unconfirmed
GUEST, unregistred user!
用户注销时报Edatabaseerror错,经单步跟踪调试,发现程序运行时不断刷新dbgrid的背景显示,当注销用户时此处便会报“Edatabaseerror错”,大家帮忙看看如何解决?
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Query1.FieldByName('Red').AsString = 'A' then //注销用户时,运行到这里就报错
DbGrid1.Canvas.Brush.color:=clRed;
......
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if Query1.FieldByName('Red').AsString = 'A' then //注销用户时,运行到这里就报错
DbGrid1.Canvas.Brush.color:=clRed;
......
DBGrid1.DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;