Beispiel #1
0
        public bool DeleteLoaiTB(LoaiTB ttloaiTB)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("delete from LoaiThietBi where MaLoaiTB=@idLoaiTB", con);

            cmd.Parameters.AddWithValue("@idLoaiTB", ttloaiTB.maLoaiTB);
            cmd.ExecuteNonQuery();
            con.Close();
            return(true);
        }
Beispiel #2
0
        public void UpdateLoaiTB(LoaiTB ttloaiTB)
        {
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("update LoaiThietBi set TenLoaiTB=@tenLoaiTB, XuatXu=@xuatXu where MaLoaiTB=@idLoaiTB", con);

            cmd.Parameters.AddWithValue("@idLoaiTB", ttloaiTB.maLoaiTB);
            cmd.Parameters.AddWithValue("@tenLoaiTB", ttloaiTB.tenLoaiTB);
            cmd.Parameters.AddWithValue("@xuatXu", ttloaiTB.xuatXu);
            cmd.ExecuteNonQuery();
            con.Close();
        }
Beispiel #3
0
        public string InsertLoaiTB(LoaiTB ttLoaiTB)
        {
            string        Message;
            SqlConnection con = new SqlConnection(strQuery);

            con.Open();
            SqlCommand cmd = new SqlCommand("insert into LoaiThietBi(TenLoaiTB,XuatXu) values(@tenLoaiTB,@xuatXu)", con);

            cmd.Parameters.AddWithValue("@tenLoaiTB", ttLoaiTB.tenLoaiTB);
            cmd.Parameters.AddWithValue("@xuatXu", ttLoaiTB.xuatXu);
            int result = cmd.ExecuteNonQuery();

            if (result == 1)
            {
                Message = ttLoaiTB.tenLoaiTB + "them thanh cong";
            }
            else
            {
                Message = ttLoaiTB.tenLoaiTB + "them khong thanh cong";
            }
            con.Close();
            return(Message);
        }