Hello everyone, I recently started using C # and came across a few problems, for example, to update datagridview so that everything would remain in its place (for example, it wouldn’t scour it up, the line with which we work and so on would remain highlighted). And they began to worry. After various actions, for example, add a new record \ edit the current one, I call update_orders (); so that after adding I see the change in datagridview right away, am I doing the right thing?
public void update_orders() { cn.Open(); BindingSource bs = new BindingSource(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); SqlDataAdapter da = new SqlDataAdapter(); da = new SqlDataAdapter("тут запрос", cn); da.Fill(dt); bs.DataSource = dt; gridOrder.DataSource = bs; cn.Close(); }