How can I insert some rows from a datagrid to a database ?
Rajib
Printable View
How can I insert some rows from a datagrid to a database ?
Rajib
not be the best one, but hope this would help
cheers. :afrog:VB Code:
private void Form1_Load(object sender, System.EventArgs e) { //conn is a connection from sql //DataAdapter da //ds is your DataSet da.SelectCommand=new SqlCommand("select * from student",conn); ds.Tables.Add(new DataTable("test")); da.Fill(ds.Tables["test"]); this.dataGrid1.DataSource=ds.Tables["test"]; } private void btnsave_click(object sender, System.EventArgs e) { if (ds.HasChanges()) { SqlCommandBuilder cm = new SqlCommandBuilder(da); da.Update(ds,"test"); } }