I have a windows form with a DataGridView databoud to a single table. On the page load i run a query to return a single row in the DataGrid View:
private void SQL__Edit_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'sQLInfrastructureADD_EDIT.SQLInfrastructure' table. You can move, or remove it, as needed.
this.sQLInfrastructureTableAdapter.Fill(this.sQLInfrastructureADD_EDIT.SQLInfrastructure);
{
SqlDataAdapter sba = new SqlDataAdapter("Select * from dbo.SQLInfrastructure WHERE [Instance] LIKE '" + label1.Text + "%'", connn);
System.Data.DataTable data = new System.Data.DataTable();
sba.Fill(data);
sQLInfrastructureDataGridView.DataSource = data;
}
}
I then have a binding navigator with a save button:
private void sQLInfrastructureBindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.sQLInfrastructureBindingSource.EndEdit();
this.tableAdapterManager.UpdateAll(this.sQLInfrastructureADD_EDIT);
}
When I remove the query the entire table loads and saves with the binding navigator, when I add the query to only load a single row that needs to be edited it does not save the changes to the database. Please instruct me how to run this query and save changes to the database from the results with a binding navigator.