Chat sexarab - Updating database with datagrid in


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.But in my dataset there are 4 table with join (i.e.You can insert, upadate and delete data of database from datagrid view.

For ex: I am having "Datagridview", "Edit" and "Save" button on Win Form and table "Emp Details" at backend in databse.

I am filling "Datagridview" with table "Emp Details".

Virtual mode gives you a higher degree of control by allowing you to wait until a cell is actually being displayed to provide the value it will contain. Sql Client Public Class Form1 Dim s Command As Sql Command Dim s Adapter As Sql Data Adapter Dim s Builder As Sql Command Builder Dim s Ds As Data Set Dim s Table As Data Table Private Sub load_btn_Click(By Val sender As System. Open() s Command = New Sql Command(sql, connection) s Adapter = New Sql Data Adapter(s Command) s Builder = New Sql Command Builder(s Adapter) s Ds = New Data Set() s Adapter.

The following source code illustrate how to connect a Data Grid View to a database and addnew/update or delete the database values from Data Grid View.

The Data Grid View can display data in Bound mode, unbound mode and Virtual mode .