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