Esempio n. 1
0
        //code without use

        /*private void btnAdd_Click(object sender, System.EventArgs e)
         * {
         *      string empID = txtEmployeeID.Text ;
         *      string LName = txtLName.Text ;
         *      string FName = txtFName.Text;
         *      string sPec = cboSpecialty.SelectedItem.ToString();
         *      string sMsg = "";
         *
         *      DataSet o_Add = new DataSet ();
         *      Employees oEmployees = new Employees();
         *
         *      try
         *      {
         *              sMsg = oEmployees.AddData(empID,LName,FName,sPec);
         *      }
         *      catch
         *      {
         *              sMsg = "Error saving data." + "\n\n" + e.ToString();
         *      }
         *      finally
         *      {
         *              MessageBox.Show (sMsg, "Add Record", MessageBoxButtons.OK);
         *      }
         * }*/

        private void btnAdd_Click_1(object sender, System.EventArgs e)
        {
            string empID = txtEmployeeID.Text;
            string LName = txtLName.Text;
            string FName = txtFName.Text;
            string sPec  = cboSpecialty.Text;
            string etype = cboType.Text;
            string sMsg  = "";

            Employees oEmployees = new Employees();

            try
            {
                sMsg = oEmployees.AddData(empID, LName, FName, etype, sPec);
                LoadEmployeeData();
            }
            catch
            {
                sMsg = "Error saving data." + "\n\n" + e.ToString();
            }
            finally
            {
                MessageBox.Show(sMsg, "Add Record", MessageBoxButtons.OK);
            }
        }