I am working at winforms project and i have a datagridview from which i am trying to update a database from it when the user changes something. Here is the code:
DataSet ds = new DataSet();
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["EbosPr.Properties.Settings.Database1ConnectionString1"].ConnectionString);
SqlCommand scmd = new SqlCommand("Select * From CustCalls ", conn);
SqlDataAdapter sda = new SqlDataAdapter(scmd);
sda.Fill(ds);
DataTable dt = ds.Tables[0];
this.dataGridView1.BindingContext[dt].EndCurrentEdit();
SqlCommandBuilder myBuilder = new SqlCommandBuilder(sda);
myBuilder.GetUpdateCommand();
sda.UpdateCommand = myBuilder.GetUpdateCommand();
sda.Update(dt);
The above code doesnt update the database. Any idea?