I have a nice litte DataGridView, which gets loaded/populated by a button and a SQLDataAdapter and the corresponding saveButton.
private void loadButton_Click(object sender, EventArgs e)
{
String connString = conStringComboBox.Text;
String query = queryStringComboBox.Text;
dAdapter = new SqlDataAdapter(query, connString);
SqlCommandBuilder cBuilder = new SqlCommandBuilder(dAdapter);
dTable = new DataTable();
dAdapter.Fill(dTable);
bSource = new BindingSource();
bSource.DataSource = dTable;
dataGridView.DataSource = bSource;
}
private void saveButton_Click(object sender, EventArgs e)
{
dAdapter.Update(dTable);
}
Whenever I edit something in the dataGridView and click save everything is just peachy. The value in the correct cell on the the SQL-Server gets updated.
BUT I implemented a little editor for better overview. Value of Cell X is changed there and it gets back to the DataGridview:
dataGridView.SelectedCells[0].Value = exampleString;
DataGridView Updates accordingly, I click save - Update gets executed without a hitch, but the new value obviously isn't committed to the SQL Server, because as soon as I load the same table it is displaying the old value again.
Any ideas where what I forgot here? Every Input is appreciated!