I have a Maintenance form in which I have dropped a DevExpress grid populated by a BBS bound to a Parent BO. I have also placed five other grids each in their own tab and each being populated by separate BBS's and Child BO's. I have set up the relationships of the child BO's through the designer and set the parent BO property of each child. It works fine when navigating records and the child records display as expected. I can pick a Parent record, and edit the child records, it saves and edits fine. The problem is when I try to add a Parent record and save I get an exception saying that I can't insert a null value into a field. I was under the impression that when a Parent/Child relationship is setup, SF will manage the foreign keys.
I need to lock down the parent grid but leave the child grids editable. When the user clicks edit, it unlocks the parent grid and locks the child grid until a save is made.
Here is one of the exceptions I get:
Exception (BusinessLayerException): Source="MicroFour StrataFrame Business"; Target=null; Tag=null;
Message = "An error occurred while saving an the data to the server."
InnerException (DataLayerSavingException): Source="MicroFour StrataFrame Business"; Target=null; Tag=null;
Message =
"Cannot insert the value NULL into column 'FramerID', table 'StarkMasterDB.dbo.Framers'; column does not allow nulls. INSERT fails.
The statement has been terminated."
StackTrace =
" at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)
at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)"
InnerException (SqlException): Message=(->Message); Source=".Net SqlClient Data Provider"; Target=null; Tag=null; Class=16; LineNumber=1; Number=515; Procedure=""; Server="1lprmoore"; State=2; ErrorCode=-2146232060;
StackTrace =
" at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.getMetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior ... (truncated) ...Command.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader()
at MicroFour.StrataFrame.Data.DbDataSourceItem.InternalExecuteReader(DbCommand Command, Boolean IsTransactional, String TransactionKey)
at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)
at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)
at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)"
Errors (SqlErrorCollection): Count=2;
#0 = {System.Data.SqlClient.SqlError: Cannot insert the value NULL into column 'FramerID', table 'StarkMasterDB.dbo.Framers'; column does not allow nulls. INSERT fails.}
#1 = {System.Data.SqlClient.SqlError: The statement has been terminated.}
SaveErrors (DataLayerSaveErrorCollection): Count=1;
#0 = MicroFour.StrataFrame.Data.DataLayerSaveError
Environment: ThreadIdentity="" DateTime=["2007-02-02 10:22:55.081"] ThreadName=null WindowsIdentity="STRUSS\RMoore" ThreadId="11" DemoVersion="True" DomainName=["Project Tracker.vshost.exe"] OSVersion=["Microsoft Windows NT 5.1.2600 Service Pack 2"] MachineName="1LPRMOORE" UserName="RMoore"
Any insight as to what happens to the Parent and Child BO's when the edit, save, delete, and new buttons are clicked on the maintenace toolstrip would be helpful.