protected void Button1_Click(object sender, EventArgs e) { #region Create a record Emp rec = new Emp(); rec.Empno = short.Parse(TxtEmpno.Text); rec.Ename = TxtName.Text; rec.Job = TxtJob.Text; rec.Salary = short.Parse(TxtSalary.Text); #endregion #region Add employ into db and save changes DbCompanyEntities dce = new DbCompanyEntities(); dce.AddToEmps(rec); dce.SaveChanges(); #endregion }
/// <summary> /// Deprecated Method for adding a new object to the Emps EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToEmps(Emp emp) { base.AddObject("Emps", emp); }
/// <summary> /// Create a new Emp object. /// </summary> /// <param name="empno">Initial value of the Empno property.</param> public static Emp CreateEmp(global::System.Int16 empno) { Emp emp = new Emp(); emp.Empno = empno; return emp; }