Beispiel #1
0
 void ganDL(SinhVienDT dt)
 {
     dt.Mathe      = txtMaThe.Text.Trim();
     dt.Tensv      = txtTen.Text.Trim();
     dt.Ngaysinh   = dateNgaySinh.Text.Trim();
     dt.Diachi     = txtDiaChi.Text.Trim();
     dt.Lop        = txtLop.Text.Trim();
     dt.Khoa       = txtKhoa.Text.Trim();
     dt.Ngaycapthe = dateNgayCap.Text.Trim();
     dt.Ngayhethan = dateNgayHetHan.Text.Trim();
     dt.Gioitinh   = txtGioiTinh.Text.Trim();
 }
Beispiel #2
0
 //SỬA dl
 public bool UpdateData(SinhVienDT dt)
 {
     cmd.CommandText = "UPDATE sinhvien SET TenSV= N'" + dt.Tensv + "', NgaySinh= CONVERT ( '" + dt.Ngaysinh + "', 103), N'" + dt.Diachi + "',Lop= N'" + dt.Lop + "', Khoa= N'" + dt.Khoa + "', NgayCapThe= CONVERT ('" + dt.Ngaycapthe + "', 103),NgayHetHan= CONVERT (N'" + dt.Ngayhethan + "', 103), gioitinh= N'" + dt.Gioitinh + "' WHERE MaThe ='" + dt.Mathe + "'";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = conn.Connection;
     try
     {
         conn.OpenConn();
         cmd.ExecuteNonQuery();
         conn.CloseConn();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         conn.CloseConn();
     }
     return(false);
 }
Beispiel #3
0
 //thêm mới dl
 public bool AddData(SinhVienDT dt)
 {
     cmd.CommandText = "INSERT INTO loaisach VALUES ( '" + dt.Mathe + "', N'" + dt.Tensv + "', CONVERT ( '" + dt.Ngaysinh + "', 103), N'" + dt.Diachi + "', N'" + dt.Lop + "', N'" + dt.Khoa + "', CONVERT ('" + dt.Ngaycapthe + "', 103), CONVERT (N'" + dt.Ngayhethan + "', 103), N'" + dt.Gioitinh + "') ";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = conn.Connection;
     try
     {
         conn.OpenConn();
         cmd.ExecuteNonQuery();
         conn.CloseConn();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         conn.CloseConn();
     }
     return(false);
 }
Beispiel #4
0
 public bool UpdateData(SinhVienDT dt)
 {
     return(MH.UpdateData(dt));
 }
Beispiel #5
0
 public bool AddData(SinhVienDT dt)
 {
     return(MH.AddData(dt));
 }