Sql Server in C # using BindingSource

2

I'm in a project where I have a sale screen. When you make a sale, a method checks if the customer has an account. If he does not have it, he creates one for him, so far so good. But if the customer already owns this account, he needs to change the data only. But when I change the data using BindingSource , it changes by DataGridView and is changing the first record only.

I need a filter that takes the name of the client to be changed, and automatically it puts me in the row of the datagridview of that client that will already be registered. I tried this but it did not work out.

String searchValue = txtNome.Text;

int rowIndex = -1;
foreach (DataGridViewRow row in dgvFicha.Rows)
{
  if (row.Cells[2].Value.ToString().Equals(searchValue))
  {
     rowIndex = row.Index;
     break;
  }
}
    
asked by anonymous 17.08.2017 / 18:45

0 answers