Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 3
0
 public bool UpdateData(LoaiSachDT dt)
 {
     return(MH.UpdateData(dt));
 }
Exemplo n.º 4
0
 public bool AddData(LoaiSachDT dt)
 {
     return(MH.AddData(dt));
 }
Exemplo n.º 5
0
 //ham lay dl tu control
 void ganDL(LoaiSachDT dt)
 {
     dt.MaLS  = txtMa.Text.Trim();
     dt.TenLS = txtTen.Text.Trim();
 }