Version: 2.5 Final
Runtime Library Version: 2.5.08.0122
Template: Self-Servicing
.NET Version: 2.0
Database: SQL Server 2005
I am having a strange problem.
I have a Windows Forms application that is using LLBLGen.
I have a particular form that is used to configure inventory parts called PartConfiguratorForm.
Based on the 'Part Type' there is the functionality to launch another instance of PartConfiguratorForm, configure a child part to be linked to the currently selected part, and return to the parent form.
The form creates an entity called 'PartEntity' that is saved at the end of the configuration process.
The strange thing is that the entity saves with no errors on the initial instance of the PartConfiguratorForm but an error gets thrown when trying to save the entity on a 'sub' instance of the form.
The error is:
An exception was caught during the execution of an action query: Cannot insert the value NULL into column 'PartNumber', table 'ACRO_Manufacturing.dbo.Part'; column does not allow nulls. INSERT fails.
The statement has been terminated.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
Stack Trace:
at SD.LLBLGen.Pro.ORMSupportClasses.ActionQuery.Execute()
at SD.LLBLGen.Pro.ORMSupportClasses.BatchActionQuery.Execute()
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteActionQuery(IActionQuery queryToExecute, ITransaction containingTransaction)
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.AddNew(IEntityFields fields, ITransaction containingTransaction)
at ABS.BusinessObjects.EntityClasses.PartEntity.InsertEntity() in C:\Documents and Settings\dlau.CSD\My Documents\LLBLGen Pro Projects\ACRO Manufacturing\EntityClasses\PartEntity.cs:line 6655
at SD.LLBLGen.Pro.ORMSupportClasses.EntityBase.CallInsertEntity()
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.PersistQueue(List`1 queueToPersist, Boolean insertActions, ITransaction transactionToUse, Int32& totalAmountSaved)
at SD.LLBLGen.Pro.ORMSupportClasses.UnitOfWork.Commit(ITransaction transactionToUse, Boolean autoCommit)
at ABS.UI.PartConfigurator.PartConfiguratorForm.SaveEntity() in C:\ACRO\ABS.UI.PartConfigurator\ABS.UI.PartConfigurator\PartConfiguratorForm.cs:line 475
The 'QueryExecuted' is:
INSERT INTO [ACRO_Manufacturing].[dbo].[Part] ([Description], [PartType], [PartClass], [PartGroup], [SalesUnitPrice], [InventoryUM], [PurchasingUM], [PurchasingFactor], [Notes]) VALUES (@Description, @PartType, @PartClass, @PartGroup, @SalesUnitPrice, @InventoryUm, @PurchasingUm, @PurchasingFactor, @Notes)
Parameter: @Description : String. Length: 50. Precision: 0. Scale: 0. Direction: Input. Value: "MY COMPONENT A".
Parameter: @PartType : String. Length: 1. Precision: 0. Scale: 0. Direction: Input. Value: "P".
Parameter: @PartClass : String. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "ab".
Parameter: @PartGroup : String. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "abc".
Parameter: @SalesUnitPrice : Decimal. Length: 0. Precision: 18. Scale: 4. Direction: Input. Value: 1.
Parameter: @InventoryUm : String. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "EA ".
Parameter: @PurchasingUm : String. Length: 10. Precision: 0. Scale: 0. Direction: Input. Value: "EA ".
Parameter: @PurchasingFactor : Decimal. Length: 0. Precision: 18. Scale: 5. Direction: Input. Value: 1.
Parameter: @Notes : AnsiString. Length: 2147483647. Precision: 0. Scale: 0. Direction: Input. Value: "PART NOTES.
".
It is missing the 'PartNumber' column in the insert statement.
The 'PartNumber' field does have a value of 'MY_COMP_A' right before running this code:
unitOfWork.AddForSave(partEntity, true);
unitOfWork.Commit(transaction, true);
Any idea why this could be happening?
I am very confused.
Please help!