Example #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();
        }
Example #2
0
 public PhieuMuon()
 {
     docGia = new DocGia();
     nhanVien = new NhanVien();
     sach = new Sach();
 }
Example #3
0
 public CT_PhieuMuon()
 {
     sach = new Sach();
     phieuMuon = new PhieuMuon();
 }
Example #4
0
 public void Update(Sach info)
 {
     sD.Update(info);
 }
Example #5
0
 public void Insert(Sach info)
 {
     sD.Insert(info);
 }
Example #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();
        }