TMVCActiveRecord.CurrentConnection.StartTransaction; try //do TMVCActiveRecord.CurrentConnection.Commit; Render(201, 'Create Successfully', ''); except on E: Exception do begin TMVCActiveRecord.CurrentConnection.Rollback; if E.Message.Contains('不能在对象 ''dbo.MOCTC'' 中插入重复键。') then begin raise EMVCException.Create('Slipcode already exists!', '', 0, 404); end else raise EMVCException.Create(E.Message, '', 0, 404); end; end;
中年大叔学Delphi