Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Source Error: Line 44: public ReceiptEntity GetReceiptByPKForPrint(Guid receiptPK) Line 45: { Line 46: return this.GetEntity("ReceiptsSelectByPKForPrint", Line 47: this.CreateParameter("@ReceiptPK", receiptPK)); Line 48:This is called when I want to print a receipt that has just been added to the database. It works when there is only one detail line in the receipt but when there are two lines I get this error.