コード例 #1
0
        public void Xoa(KhenThuongEntity tk)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"DELETE tblKhenThuong WHERE MaKT=@MaNN";
            SqlCommand cdm = new SqlCommand(sql, KetNoiCSDL.connect);

            cdm.Parameters.AddWithValue("@MaNN", tk.MaKT);
            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
コード例 #2
0
        public void Sua(KhenThuongEntity tk)
        {
            KetNoiCSDL.MoKetNoi();
            string     themhd = @"UPDATE tblKhenThuong SET TenKT =@TenNN Where MaNN=@MaNN";
            SqlCommand cdm    = new SqlCommand(themhd, KetNoiCSDL.connect);

            // cdm.CommandType = CommandType.StoredProcedure;

            cdm.Parameters.AddWithValue("@MaNN", tk.MaKT);
            cdm.Parameters.AddWithValue("@TenNN", tk.TenKT);

            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
コード例 #3
0
        public void Them(KhenThuongEntity tk)
        {
            KetNoiCSDL.MoKetNoi();
            string     themhd = @"INSERT INTO tblKhenThuong(MaKT,TenKT) VALUES(@MaNN,@TenNN)";
            SqlCommand cdm    = new SqlCommand(themhd, KetNoiCSDL.connect);

            // cdm.CommandType = CommandType.StoredProcedure;

            cdm.Parameters.AddWithValue("@MaNN", tk.MaKT);
            cdm.Parameters.AddWithValue("@TenNN", tk.TenKT);

            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }