procedure TForm3.Table2PostError(DataSet: TDataSet; E: EDatabaseError;
  var Action: TDataAction);
  begin
     if (E as eDBENGineError).Errors[0].Errorcode=13059 then
      begin
      showmessage('1');
      messagedlg('不能为空)!',mtwarning,[mbok],0);
      abort;
      end
      else
      begin
      if (E as eDBENGineError).Errors[0].Errorcode=9729 then
      begin
      messagedlg('该人员信息已经被输入!也可能是工号重复了,请重新输入!',mtwarning,[mbok],0);
      abort;
      end;
      end; 
end;
当主键为空时,增加报错invalid class typecast,问什么原因?