Mid ADO.NET ADO.NET

Call the Update method on the DataAdapter to sync changes. Example: // Assuming you already have a populated DataTable DataTable table = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Customers", connection); // Set commands for Insert, Update, and Delete

dapter.UpdateCommand = new SqlCommand("UPDATE Customers SET

CustomerName = @CustomerName WHERE CustomerID = @CustomerID",

connection);

dapter.UpdateCommand.Parameters.Add("@CustomerName",

SqlDbType.NVarChar, 100, "CustomerName");

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

4, "CustomerID");

// Update the database

dapter.Update(table);

fter modifying the DataTable, the Update method pushes those changes to the database.

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