I am using mysql and datagridview for storing and retrieving purpose., I just done saving the data from datagridview to mysql. But while I'm loading mysql into again that same datagridview, the datagridview become twice.
private void btnload_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
string st = "select * from searchsong";
MySqlDataAdapter ad = new MySqlDataAdapter(st, con);
MySqlCommandBuilder cmd = new MySqlCommandBuilder(ad);
ad.Fill(dt);
BindingSource bg = new BindingSource();
bg.DataSource = dt;
dataGridView1.DataSource = bg;
}
In this "con"- connection string and "searchsong" is table name.