G
Guest
I am populating an ASP.NET 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()
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()