"Input string was not in a correct format"
var get = dc.table.Where(b => b.IdRow == id).SingleOrDefault();
private void IdRowtextBox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Entities dc = new Entities(); int id = Convert.ToInt32(IdRowtextBox.Text) ; var get = dc.table.Where(b => b.IdRow == id).SingleOrDefault(); nametextBox.Text = get.name.ToString ();
It was a problem in the model entity , I added a wrong association .
int id; if (int.TryParse(IdRowtextBox.Text.Trim(), out id)) { var get = dc.table.Where(b => b.IdRow == id).SingleOrDefault(); nametextBox.Text = get.name.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)