private void button1_Click(object sender, EventArgs e) { TableStudent s = new TableStudent(); s.Email = textBox3.Text; s.Name = this.textBox2.Text; s.Id = Convert.ToInt32(textBox1.Text); crmEntities crmEntities = new crmEntities(); crmEntities.TableStudents.Add(s); crmEntities.SaveChanges(); if (crmEntities.TableStudents.Any(n => n.Id == s.Id)) { MessageBox.Show(s.Id + "Added!"); } }