can't catch DBConcurrencyException when using TableAdapter

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rote

    can't catch DBConcurrencyException when using TableAdapter

    I have a TableDapter built from an Oracle Table.
    When i test for Concurrency by opening 2 sessions and edit the 2 at once the
    intial record record i update shows up and not the last one until i
    refresh too see the new record.
    But when i try doing this below to catch an excpetion no luck
    protected void GridView1_RowUp dated(object sender, GridViewUpdated EventArgs
    e)

    {

    //It keeps returning -1
    Response.Write( e.AffectedRows. ToString());


    if (e.Exception != null && e.Exception.Inn erException != null)

    {

    if (e.Exception.In nerException is DBConcurrencyEx ception)

    {

    Label1.Visible = true;

    e.ExceptionHand led = true;

    }

    }

    }

    What i understood is that AffectedRows need to return 0 for this to work
    but mine keeps returning -1.
    Any help


Working...