Exemplo n.º 1
0
        private void tambahSubBidang()
        {
            BidangBagian bdg = new BidangBagian();

            bdg.setBidang(textBoxSubBidangTambah.Text);
            string bidang = bdg.getBidang();

            Database        db      = new Database();
            string          strconn = db.getString();
            MySqlConnection conn    = new MySqlConnection(strconn);

            conn.Open();
            string       query = "INSERT INTO sub_bagian_bidang VALUES(NULL, @id_bidang, @nama_sub_bagian_bidang)";
            MySqlCommand cmd   = new MySqlCommand(query, conn);

            cmd.Parameters.AddWithValue("@nama_sub_bagian_bidang", bidang);
            cmd.Parameters.AddWithValue("@id_bidang", id_bagian);
            int hasil = cmd.ExecuteNonQuery();

            if (hasil > 0)
            {
                MessageBox.Show("Data berhasil ditambah", "Sukses");
                frm1.getAllSubBidang();
            }
            else
            {
                MessageBox.Show("Data gagal ditambah", "Gagal");
            }

            conn.Close();
        }
        private void tambahSubBidang()
        {
            BidangBagian bdg = new BidangBagian();
            bdg.setBidang(textBoxSubBidangTambah.Text);
            string bidang = bdg.getBidang();

            Database db = new Database();
            string strconn = db.getString();
            MySqlConnection conn = new MySqlConnection(strconn);
            conn.Open();
            string query = "INSERT INTO sub_bagian_bidang VALUES(NULL, @id_bidang, @nama_sub_bagian_bidang)";
            MySqlCommand cmd = new MySqlCommand(query, conn);
            cmd.Parameters.AddWithValue("@nama_sub_bagian_bidang", bidang);
            cmd.Parameters.AddWithValue("@id_bidang", id_bagian);
            int hasil = cmd.ExecuteNonQuery();
            if (hasil > 0)
            {
                MessageBox.Show("Data berhasil ditambah", "Sukses");
                frm1.getAllSubBidang();

            }
            else
            {
                MessageBox.Show("Data gagal ditambah", "Gagal");
            }

            conn.Close();
        }
Exemplo n.º 3
0
        private void cariBidang()
        {
            BidangBagian namaBidang = new BidangBagian();
            string       cari       = textBoxCariBidang.Text;

            Database        db      = new Database();
            string          strconn = db.getString();
            MySqlConnection conn    = new MySqlConnection(strconn);

            conn.Open();

            string query = "SELECT * FROM bagian_bidang WHERE nama_bagian_bidang LIKE '%" + cari + "%'";
            //MessageBox.Show(query);
            MySqlCommand cmd = new MySqlCommand(query, conn);

            cmd.Parameters.AddWithValue("@cari", cari);
            MySqlDataReader reader = cmd.ExecuteReader();

            setDataTable(reader);
            conn.Close();
        }
Exemplo n.º 4
0
        private void cariBidang()
        {
            BidangBagian namaBidang = new BidangBagian();
            string cari = textBoxCariBidang.Text;

            Database db = new Database();
            string strconn = db.getString();
            MySqlConnection conn = new MySqlConnection(strconn);
            conn.Open();

            string query = "SELECT * FROM bagian_bidang WHERE nama_bagian_bidang LIKE '%" + cari + "%'";
            //MessageBox.Show(query);
            MySqlCommand cmd = new MySqlCommand(query, conn);
            cmd.Parameters.AddWithValue("@cari", cari);
            MySqlDataReader reader = cmd.ExecuteReader();

            setDataTable(reader);
            conn.Close();
        }