6
Answers

datagridview values

Shyja Abraham

Shyja Abraham

13y
1.9k
1
hai,
 i have a form with a several textboxes  and datagridview. when i enter the name of the student the names are displayed in the datagridview. but i have a problem  that ,the values in datagridview are doubled each time enter the textboxes. plz help. 

i use this code .
private void textBox14_TextChanged(object sender, EventArgs e)
  {
  namegrid.Visible = true;
  cmd.CommandText = "select staffname from staff where staffname like '" + textBox14.Text + "%'";


  da.SelectCommand = cmd;
  da.Fill(ds, "item");
  DataTable dt = ds.Tables["item"];
  namegrid.DataSource = dt;
}


Answers (6)