Exemple #1
0
 //SỬA dl
 public bool UpdateData(LoaiSachDT dt)
 {
     cmd.CommandText = "UPDATE loaisach SET tenLS=N'" + dt.TenLS + "' WHERE maLS ='" + dt.MaLS + "'";
     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);
 }
Exemple #2
0
 //thêm mới dl
 public bool AddData(LoaiSachDT dt)
 {
     cmd.CommandText = "INSERT INTO loaisach VALUES ( '" + dt.MaLS + "',N'" + dt.TenLS + "')";
     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);
 }
 public bool UpdateData(LoaiSachDT dt)
 {
     return(MH.UpdateData(dt));
 }
 public bool AddData(LoaiSachDT dt)
 {
     return(MH.AddData(dt));
 }
Exemple #5
0
 //ham lay dl tu control
 void ganDL(LoaiSachDT dt)
 {
     dt.MaLS  = txtMa.Text.Trim();
     dt.TenLS = txtTen.Text.Trim();
 }