Updating database from datagridview in vb net
Hi steve, In this scenario the edit operation depends on the bound object that in your case is Data Table/Data Set.Data Row/Data Row View objects implement IEditable Object and when some data in Rad Grid View is changed, the internal Currency Manager calls End Edit of current item after the current position is changed to another row.I tried to bind a temporary datatable object to Data Grid View and then update the main table, but I was not able to do so.I used the adapter's Fill() method, which takes the starting record and number of records as input parameters with dataset.What I want is, when User makes changes in datagridview and clicks save or update button, the changes which are made in datagridview should get reflect in table in databse.For ex: I am having "Datagridview", "Edit" and "Save" button on Win Form and table "Emp Details" at backend in databse.After making changes in "Datagridview" when user clicked "Save" button, whichever changes made in datagridview should get reflect at backend in table "Emp Details". Tables; //now u can save changes to back end with da.Use this code to populate datagridview Sql Data Adapter da=new Sql Data Adapter("select * from product",strcon); Sql Command Builder cb=new Sql Command Builder(da); Data Set ds = new Data Set(); da. Update(ds); Thanks It is working fine if there is single table in dataset.
I have faced a very common problem of cross thread exception.
This new thread will not be able to access the controls on the parent thread.