Пример #1
0
        private void button22_Click(object sender, EventArgs e)
        {
            DbConnecter dbConn = new DbConnecter();

            dbConn.connect();
            dataGridView1.DataSource = dbConn.Load().Tables[0];
            //MySqlConnection connection = new MySqlConnection("server=localhost;user=dbcli;database=demojustripedb;port=3306;password=dbcli123");
            //MySqlConnection connection = dbConn.getConn();
            //MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM demojustripedb.labourer", connection);

            //connection.Open();

            //try
            //{
            //    DataSet ds = new DataSet();
            //    adapter.Fill(ds, "labourer");
            //    dataGridView1.DataSource = ds.Tables["labourer"];
            //    connection.Close();
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message);

            //}
        }
Пример #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 !! ");
        }