Ejemplo n.º 1
0
        public void Insert(TheLoai info)
        {
            cnn = helper.GetConnect();
            sqlString = "Insert into THELOAI(id, Ten) values ('" + info.Id + "',N'" + info.Ten +"')";
            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();
        }
Ejemplo n.º 2
0
 public int isValid()
 {
     if (TenSach.Equals(""))
     {
         return(1);
     }
     if (TacGia.Equals(""))
     {
         return(2);
     }
     if (SoLuong <= 0)
     {
         return(3);
     }
     if (TheLoai.Equals(""))
     {
         return(4);
     }
     if (TomTat.Equals(""))
     {
         return(5);
     }
     return(0);
 }
Ejemplo n.º 3
0
 public void Update(TheLoai info)
 {
     tlD.Update(info);
 }
Ejemplo n.º 4
0
 public void Insert(TheLoai info)
 {
     tlD.Insert(info);
 }
Ejemplo n.º 5
0
 public Sach()
 {
     nxb = new NXB();
     tacGia = new TacGia();
     theLoai = new TheLoai();
 }
Ejemplo n.º 6
0
 public void Update(TheLoai info)
 {
     sqlString = "UPDATE THELOAI SET Ten=N'" + info.Ten +
         "' 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();
 }