DBConcurrency Exception

J

James

I am populating a datagrid with a dataview object stored in session state
To update the database I am using a commandbuilder object to generate the relevant statements

I can update and delete rows without having to re-fill the dataset (dataview)
However, if I add a new row and then delete it after postback, using the datagrid, I get a DBConcurrency exception (there are no other users making changes to the database)

If I insert the new row and then re-fill the dataset (dataview), it works perfectly

Is this how I am supposed to insert rows? Can't I get around having to re-populate the whole dataset

Here's a snippet of my code that does an insert
Dim dv As DataView = CType(Session("DataView"), DataView

' insert new row into datavie
Dim dr As DataRow = dv.Table.NewRo
dr.Item("Artist") = txtArtist.Tex
dr.Item("Title") = txtTitle.Tex
dv.Table.Rows.Add(dr

' make changes to database (using command builder
UpdateData(dv

' re-fill the dataset (dataview
LoadData(

' rebind the datagri
FillGrid()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top