none
SqlDataAdapter.Update Exception RRS feed

  • Question

  • when i'm trying to update the db as a batch update i get this exception

    Constrain exception was unhandeled

    column ID is constrained to be uniqe value 1 is already present

     

    (why the adapter makes such probem its assumed that when it goes to the DB it gets back the Primary key value and update the dataset table with the PK value if its newly inserted )

    ofcourse i choosd (refresh the datatable option when i created the adapter and use optimistics concurrency)

     

    usage scenario

     

    button1_click()

    {

    dataset1.table1.addnewtable1row("string1","string2");

    }

    button2_click()

    {

    datarow dr=dataset.table1.rows.find();

    dr.delete;

    }

    button3_click()

    {

    adapter.update(dataset1.table1);

    }

    Thursday, June 28, 2007 8:08 PM