예제 #1
0
        public int addNewLabourer(MySqlConnection conn, Labourer labourer)
        {
            string sql = "INSERT INTO labourer (name, age, gender) " + "VALUES ('" + labourer.Name + "'," + labourer.Age + "  , '" + labourer.Gender + "')";

            MySqlCommand sqlComm = new MySqlCommand(sql, conn);

            return(sqlComm.ExecuteNonQuery());
        }
예제 #2
0
        private void button20_Click(object sender, EventArgs e)
        {
            DbConnecter dbConn = new DbConnecter();

            dbConn.connect();

            Labourer labr = new Labourer();

            labr.Name   = textBox2.Text;
            labr.Age    = Convert.ToInt32(numericUpDown1.Value);
            labr.Gender = comboBox4.Text;

            LabourerHandler labHnd    = new LabourerHandler();
            int             recordCnt = labHnd.addNewLabourer(dbConn.getConn(), labr);

            MessageBox.Show(recordCnt + " record has been inserted !! ");
        }
예제 #3
0
        private void button19_Click(object sender, EventArgs e)
        {
            DbConnecter dbConn = new DbConnecter();

            dbConn.connect();

            Labourer labr = new Labourer();

            labr.Name   = "Adam";
            labr.Age    = 30;
            labr.Gender = "male";

            LabourerHandler labHnd    = new LabourerHandler();
            int             recordCnt = labHnd.addNewLabourer(dbConn.getConn(), labr);

            MessageBox.Show(recordCnt + " record has been inserted !! ");
        }