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;
标签:TMVCActiveRecord,begin,end,自定义,捕获,CurrentConnection,Create From: https://www.cnblogs.com/redhat588/p/17367810.html