public static bool ThemGoiMon(GoiMonDTO gm) { gm.MaGoiMon = MaTuTang(); bool kq; string sql = string.Format("insert into GoiMon values ({0}, {1})", gm.MaGoiMon, gm.MsBan); kq = SqlDataAccessHelper.ExecuteNonQuery(sql); return(kq); }
//Rút trích dữ liêu: select public static List <GoiMonDTO> LayDSGoiMon() { List <GoiMonDTO> _ds = new List <GoiMonDTO>(); string sql = "select * from GoiMon"; DataTable dt = SqlDataAccessHelper.ExecuteQuery(sql); for (int i = 0; i < dt.Rows.Count; i++) { GoiMonDTO gm = new GoiMonDTO(); gm.MaGoiMon = int.Parse(dt.Rows[i]["MaGoiMon"].ToString()); gm.MsBan = int.Parse(dt.Rows[i]["MaSoBan"].ToString()); _ds.Add(gm); } return(_ds); }
public static bool ThemGoiMon(GoiMonDTO gm) { bool kq = GoiMonDAO.ThemGoiMon(gm); return(kq); }