protected Update ( |
||
dataRows | ||
tableMapping | ||
return | int |
MySqlConnection connection = new MySqlConnection("server=localhost;user=root;database=myDB"); MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM myTable WHERE ID = 1", connection); MySqlCommandBuilder builder = new MySqlCommandBuilder(adapter); DataTable table = new DataTable(); adapter.Fill(table); DataRow row = table.Rows[0]; row["Column1"] = "NewValue"; row["Column2"] = "AnotherNewValue"; adapter.Update(table);This code connects to a database, selects a row with ID of 1, modifies the values of two columns, and then updates the changes in the database. Overall, the MySql.Data.MySqlClient package library provides comprehensive capabilities for working with MySql databases in C#.
protected Update ( |
||
dataRows | ||
tableMapping | ||
return | int |