Update Table only works once in datagridview (c#) -


i have datagridview in have made cells editable. once user has entered text, hit "update" button, updates database.

the problem whenever open application, update first time. when try make more modification , click "update" button, fails update database. here code. please suggest solution

private void form1_load_1(object sender, eventargs e)     {         con.open();         sda = new sqldataadapter("select * name", con);         ds = new system.data.dataset();         sda.fill(ds);         datagridview1.datasource = ds.tables[0];     }   private void button1_click(object sender, eventargs e)     {                     scb = new sqlcommandbuilder(sda);         sda.update(ds);      } 

actually, there nothing wrong code mentioned. instead there section causing db not updated.

i kept refresh button code -

private void button2_click(object sender, eventargs e)     {        sda = new sqldataadapter("select * name", con);        datatable dt = new datatable();        sda.fill(dt);        datagridview1.datasource = dt;     } 

seems reverted update original db content. removing worked successfully.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -