DBConcurrency Exception

Discussion in 'ASP .Net Datagrid Control' started by James, Feb 22, 2004.

  1. James

    James Guest

    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()
    James, Feb 22, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jeff
    Replies:
    0
    Views:
    1,527
  2. jeff
    Replies:
    3
    Views:
    1,687
    Scott
    Jun 26, 2003
  3. Kerri
    Replies:
    2
    Views:
    13,016
    Kevin Spencer
    Oct 27, 2003
  4. Ola
    Replies:
    0
    Views:
    531
  5. Selen
    Replies:
    0
    Views:
    2,680
    Selen
    May 28, 2004
Loading...

Share This Page