Hi
Dudes
Is it possible , i have two tables in data set and i want to perform DML operation on that tables like delete , update and insert , if it is possible how can any one help me...?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 27, 2011, 5:17 AM EDT
When you call da.Update(ds),then it should update the database with any insertions, updates or deletions to rows in the DataTables within the DataSet that have not yet been committed.
Jiteendra SampathiraoRank #585 · 4.1K reputationPosted Jul 26, 2011, 5:50 AM EDT
it is possible.....
String cs = String.Format(@"Provider=SQLNCLI;Data Source=
using (OleDbConnection con = new OleDbConnection(cs))
{
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM Shippers", con);
DataSet ds = new DataSet("ShipperDataSet");
da.Fill(ds);
// Create Update and Insert commands
OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(da);
da.UpdateCommand = cmdBuilder.GetUpdateCommand();
da.InsertCommand = cmdBuilder.GetInsertCommand();
// Insert row
DataRow newRow = ds.Tables[0].NewRow();
newRow["ShipperID"] = 100;
newRow["CompanyName"] = "NewCompany";
newRow["Phone"] = "123456789";
ds.Tables[0].Rows.Add(newRow);
// Update row
ds.Tables[0].Rows[0][1] = "Changed CompanyName";
// Update database using Dataset via DataAdapter
da.Update(ds);
}
Go through this LiNK
hope it help you.....
Smart LuckyRank #2,625 · 531 reputationPosted Jul 27, 2011, 4:54 AM EDT
can you send this program in sqlclient...? and if i updates and delete in data set can these chages perform on database in actual data....?
VulpesRank #55 · 29.2K reputationPosted Jul 27, 2011, 6:01 AM EDT
Thanks :)