Exemple #1
0
        public void Insert(Sach info)
        {
            cnn = helper.GetConnect();
            sqlString = "Insert into Sach(id, Ten, GiaMua, GiaBan, MaNhaCungCap, SoLuong, MaTheLoai, MaNhaXuatBan ) "
            + "values ('" + info.Id + "',N'" + info.TenSach + "','" + info.GiaMua + "','" + info.GiaBan + "','" + info.NhaCungCap + "','" + info.SoLuong + "','" + info.TheLoai + "','" + info.NhaXuatBan + "')";
            try
            {

                //Thực thi câu lệnh SQL
                cmd = new SqlCommand(sqlString, cnn);
                cmd.ExecuteNonQuery();

            }
            catch (System.Exception e)
            {
                cnn.Close();
                throw new Exception("Lỗi Kết Nối Cơ sở dữ liệu.");
            }
            cnn.Close();
        }
Exemple #2
0
 public PhieuMuon()
 {
     docGia = new DocGia();
     nhanVien = new NhanVien();
     sach = new Sach();
 }
Exemple #3
0
 public CT_PhieuMuon()
 {
     sach = new Sach();
     phieuMuon = new PhieuMuon();
 }
Exemple #4
0
 public void Update(Sach info)
 {
     sD.Update(info);
 }
Exemple #5
0
 public void Insert(Sach info)
 {
     sD.Insert(info);
 }
Exemple #6
0
        public void Update(Sach info)
        {
            sqlString = "UPDATE SACH SET Ten=N'" + info.TenSach +
                "',GiaMua='" + info.GiaMua +
                "',GiaBan='" + info.GiaBan +
                "',MaNhaCungCap='" + info.NhaCungCap +
                "',SoLuong='" + info.SoLuong +
                "',MaTheLoai='" + info.TheLoai +
                "',MaNhaXuatBan='" + info.NhaXuatBan +
                "' WHERE id='" + info.Id + "'";
            cnn = helper.GetConnect();
            try
            {

                //Thực thi câu lệnh SQL
                cmd = new SqlCommand(sqlString, cnn);
                cmd.ExecuteNonQuery();
            }
            catch (System.Exception e)
            {
                cnn.Close();
                throw new Exception("Lỗi Kết Nối Cơ sở dữ liệu.");
            }
            cnn.Close();
        }