We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

System.Data.ConstraintException

Thread ID:

Created:

Updated:

Platform:

Replies:

54360 Jan 6,2007 06:02 AM Jan 7,2007 11:46 PM Windows Forms 1
loading
Tags: GridControl
Anna Srinivasan
Asked On January 6, 2007 06:02 AM

Hi

I have a gridDataBoundControl. The grid is sorted by date column, as shown in pic1. Please note the 2nd row with date 01/05/2007. Now i change this date to 01/02/2007, now as the grid is sorted by date, this row is supposed to move to the end as shown in pic2. But now i am getting an error as shown in pic2, here Asset_id, History_date, History_type are primary keys and below is the error i am getting in output window:

System.Data.ConstraintException: Column 'ASSET_ID, HISTORY_DATE, HISTORY_TYPE' is constrained to be unique. Value '-311795, 01/01/2007 12:00:00 AM, Trader' is already present.

at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord, DataRowAction action, Boolean isInMerge)

at System.Data.DataRow.SetNewRecord(Int32 record)

at System.Data.DataRow.EndEdit()

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataColumnPropertyDescriptor.SetValue(Object component, Object value)

at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.SaveCellInfo(GridSaveCellInfoEventArgs e)

at Syncfusion.Windows.Forms.Grid.GridModelDataBinder.Syncfusion.Windows.Forms.Grid.IGridModelDataProvider.SaveCellInfo(GridSaveCellInfoEventArgs e)

at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType, Boolean dontRaiseSaveCellInfoEvent, Boolean copyReferenceOnly)

at Syncfusion.Windows.Forms.Grid.GridModel.SetCellInfo(Int32 rowIndex, Int32 colIndex, GridStyleInfo style, StyleModifyType modifyType)

at Syncfusion.Windows.Forms.Grid.GridModel.ChangeCells(GridRangeInfo range, GridStyleInfo[] cellsInfo, StyleModifyType modifyType)

at Syncfusion.Windows.Forms.Grid.GridModel.Syncfusion.Windows.Forms.Grid.IGridVolatileDataContainer.ChangeCell(Int32 rowIndex, Int32 colIndex, GridStyleInfo style)

at Syncfusion.Windows.Forms.Grid.GridVolatileData.set_Item(Int32 rowIndex, Int32 colIndex, GridStyleInfo value)

at Syncfusion.Windows.Forms.Grid.GridStyleInfoIdentity.OnStyleChanged(StyleInfoBase style, StyleInfoProperty sip)

at Syncfusion.Styles.StyleInfoBase.OnStyleChanged(StyleInfoProperty sip)

at Syncfusion.Windows.Forms.Grid.GridStyleInfo.OnStyleChanged(StyleInfoProperty sip)

at Syncfusion.Styles.StyleInfoBase.SetValue(StyleInfoProperty sip, Object value)

at Syncfusion.Windows.Forms.Grid.GridStyleInfo.set_CellValue(Object value)

at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.OnSaveChanges()

at Syncfusion.Windows.Forms.Grid.GridCellRendererBase.RaiseSaveChanges()

at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown)

catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.ConfirmChanges(Boolean closeDropDown) in :line 0

Kindly help in resolving this issue asap.

Regards
Anna


ConstraintError0.zip

Administrator [Syncfusion]
Replied On January 7, 2007 11:46 PM

Hi Anna,

This ConstraintException has to be handled by the underlying datasource of the grid(ie DataSet). Grid does not raise any events for this. Can you please double check with your DataTable/DataSet with "311795, 01/01/2007 12:00:00 AM" entry? If you want to catch this exception, you need to handle the Validating event of the grid. Please refer to the below KnowledgeBase article for more details.

What are the different validation events and event members? When are they triggered and how are they used?

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;