Mid From PDF 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();

Follow:

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM

Customers", connection);

// Set commands for Insert, Update, and Delete

adapter.UpdateCommand = new SqlCommand("UPDATE Customers SET

CustomerName = @CustomerName WHERE CustomerID = @CustomerID",

connection);

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

SqlDbType.NVarChar, 100, "CustomerName");

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

4, "CustomerID");

// Update the database

adapter.Update(table);

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

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