protected void Page_Load(object sender, EventArgs e) { GoodTypeDataContext lq = new GoodTypeDataContext(); var mylq = from gt in lq.GoodsType select gt; gvGoodsType.DataSource = mylq; gvGoodsType.DataBind(); }
private void Insert() { GoodTypeDataContext lq = new GoodTypeDataContext(); GoodsType gt = new GoodsType(); gt.tName = txtName.Text.Trim(); lq.GoodsType.InsertOnSubmit(gt); lq.SubmitChanges(); }
private void Delete() { GoodTypeDataContext lq = new GoodTypeDataContext(); var types = from gt in lq.GoodsType where gt.tName == txtNameDe.Text.Trim() select gt; foreach (var type in types) { lq.GoodsType.DeleteOnSubmit(type); } lq.SubmitChanges(); }
private void Update() { GoodTypeDataContext lq = new GoodTypeDataContext(); var types = from gt in lq.GoodsType where gt.tName == txtNamebe.Text.Trim() select gt; foreach (var type in types) { type.tName = txtNameaf.Text.Trim(); } lq.SubmitChanges(); }