Editing Record

Hello Again:
I wanted to edit only ta fielda in a row which accepts duplicate values. When i click on update, it threw this exception because the row contians a fiels which accept no duplicate values:
"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again. "
How can i resolve this problem?

code snipet:

PrivateSub btnUpdate_Click(ByVal senderAs System.Object,ByVal eAs System.EventArgs)Handles btnSave.Click

Dim rowChangeAs dsBoxes.tblBoxesRow

'Get the row to change using the primary key
rowChange = dsBoxes.tblBoxes.FindByID(m_NextID - 1)

'Change a field in the row

rowChange.BoxID = txtBoxNo.Text

rowChange.Area = drpArea.SelectedItem.Text

rowChange.Entry_Date =CDate(txtDate.Text)

rowChange.Amount = txtAmount.Text

adptBoxes.Update(dsBoxes)

EndSub


PrivateSub Page_PreRender(ByVal senderAsObject,ByVal eAs System.EventArgs)HandlesMyBase.PreRender

Dim cmdUpdateAs OleDbCommandBuilder =New OleDbCommandBuilder(adptBoxes)

adptBoxes.Update(m_dtBoxes)

End sub

Thanks alot

[2986 byte] By [Hasan] at [2007-12-16]

.NET Development

Site Classified