コード例 #1
0
        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
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Emps EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmps(Emp emp)
 {
     base.AddObject("Emps", emp);
 }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Emps EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToEmps(Emp emp)
 {
     base.AddObject("Emps", emp);
 }
コード例 #4
0
 /// <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;
 }