Esempio n. 1
0
        public List<Sach> GetList()
        {
            List<Sach> list = new List<Sach>();

            string sqlQuery = "select * from Sach";

            reader = ExecuteReader(sqlQuery);

            while (reader.Read())
            {
                Sach sach = new Sach();

                sach.MaSach = reader["MaSach"].ToString();
                sach.TenSach = reader["TenSach"].ToString();
                sach.TheLoai = reader["TheLoai"].ToString();
                sach.TacGia = reader["TacGia"].ToString();
                sach.NhaXuatBan = reader["NhaXuatBan"].ToString();
                sach.NamXuatBan = (int)reader["NamXuatBan"];
                sach.GiaBan = (double)reader["GiaBan"];
                sach.SoLuong = (int)reader["SoLuong"];
                list.Add(sach);
            }

            return list;
        }
Esempio n. 2
0
        public void Update(Sach info)
        {
            string sqlQuery = "update Sach" +
                              " set TenSach='" + info.TenSach + "'," +
                              "TheLoai='" + info.TheLoai + "'" +
                              "TacGia='" + info.TacGia + "'" +
                              "NhaXuatBan='" + info.NhaXuatBan + "'" +
                              "NamXuatBan=" + info.NamXuatBan +
                              "GiaBan=" + info.GiaBan +
                              "SoLuong=" + info.SoLuong +
                              "where MaSach='" + info.MaSach + "'";

            ExecuteNonQuery(sqlQuery);
        }
Esempio n. 3
0
        public void Insert(Sach info)
        {
            string sqlQuery = "insert into Sach values ('" +
                info.MaSach + "',N'" +
                info.TenSach + "','" +
                info.TheLoai + "','" +
                info.TacGia + "','" +
                info.NhaXuatBan + "'," +
                info.NamXuatBan + "," +
                info.GiaBan + "," +
                info.SoLuong + ")";

            ExecuteNonQuery(sqlQuery);
        }
Esempio n. 4
0
 public void Update(Sach info)
 {
     data.Update(info);
 }
Esempio n. 5
0
 public void Insert(Sach info)
 {
     data.Insert(info);
 }