Junior From PDF ADO.NET ADO.NET

What is the significance of the UpdateCommand property in DataAdapter? The UpdateCommand property of the DataAdapter specifies the SQL command used to update the database when changes are made to the data in the DataSet. The Update() method of the DataAdapter uses the UpdateCommand to push changes back to the database. Example: SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customers", connection);

dapter.UpdateCommand = new SqlCommand("UPDATE Customers SET Name =

@Name WHERE CustomerID = @CustomerID", connection);

dapter.UpdateCommand.Parameters.Add("@Name", SqlDbType.NVarChar,

100, "Name");

dapter.UpdateCommand.Parameters.Add("@CustomerID", SqlDbType.Int,

4, "CustomerID");

More from ADO.NET Core Tutorial

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details