Hello,
I load data from SQL table in a DataGridView with the following code:
SqlConnection conn;
string connectionString = @"Server=myServer; Initial Catalog=MyDatabase; Integrated Security=True;";
using (conn = new SqlConnection(connectionString))
{
SqlCommand cmd = new SqlCommand("SELECT_ENTRIES", conn);
cmd.CommandType = CommandType.StoredProcedure;
//Fill The DataTable From Command
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
//Set It To Binding Navigator
gridDetailsView.DataSource = dt;
gridDetailsView.Dock = DockStyle.Fill;
}
I've created stored procedures for updating (UPDATE_ENTRIES) and insert new data (INSERT_ENTRIES) to the table in SQL Server.
How can I update the table when the user change row in DataGridView?
Thank you in advance.