| Author: shakti singh tanwar 09 May 2008 | Member Level: Diamond | Rating: Points: 2 |
Command builder is used to automatically generate insert,update and delete commands from a data adapter that has a select command associated with it.
e.g
SqlConnection con = new SqlConnection("ConnectionString"); SqlCommand cmd = new SqlCommand("Select * from table",con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds, "table"); //make changes in dataset
SqlCommandBuilder builder = new SqlCommandBuilder(da); da.Update(ds, "table"); //Will update the data from dataset to database
|
| Author: swathi.chilumula 10 May 2008 | Member Level: Gold | Rating: Points: 2 |
Command Builder will configure DataAdapter vth Insert, Delete, and Update statement....
// For saving the Record into DB //
SqlCommandBuilder cb = new SqlCommandBuilder(da); MessageBox.Show(cb.GetInsertCommand().CommandText); da.InsertCommand = cb.GetInsertCommand(); da.Update(ds, "table"); MessageBox.Show("Record Saved");
|
| Author: karthekeyan 11 May 2008 | Member Level: Diamond | Rating: Points: 2 |
www.radsoftware.com.au/articles/usingcommandbuilder.aspx
|