'Save Changes in DataGridView C#

After calling the table from the database into the dataGridView and entering data into the empty cells of this DataGridView, I want to save this data to my database by clicking on the button, but I don’t know how to do this

This is how I access db:

public MySqlConnection mycon;
 public MySqlCommand mycom;
 public string connect = "Server=localhost;Database=base;Uid=root;password=pas;charset=utf8";
 public SD.DataSet ds;

 mycon = new MySqlConnection(connect);
 mycon.Open();

 MySqlDataAdapter ms_data = new MySqlDataAdapter(script, connect);
 SD.DataTable table = new SD.DataTable();
 ms_data.Fill(table);
 dataGridView1.DataSource = table;
 mycon.Close();


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source