在TDataSetProvider的OnUpdateError里面
var
  sDBError : EDBEngineError;
  iCpunt : Integer;
begin
  frmErrorServer.edit1.text := IntToStr(E.Errorcode);
  frmErrorServer.edit2.text := E.Context;
  if (E.Errorcode <> 0) then
    if (E.OriginalException is EDBEngineError) then
      begin
        eDBError := E.OriginalException as EDBEngineError;
        ShowMessage(IntToStr(sDBError.ErrorCount));
        for iCount := 0 to eDBError.ErrorCount -1 do
        begin
          frmErrorServer.Listbox1.Items.Add(IntToStr(eDBError.Errors[iCount].NativeError));//这样就能得到原生错误码了,你根据这个自定义错误消息
        end;
      end;
end;