Tuesday, September 18, 2012

Insert and Select statements Using Linq in asp.net

Custom Search

tblcandidateData cdata = new tblcandidateData();

tcdata.FirstName = txtfirstname.Text;
tcdata.LastName = txtlastname.Text;
tcdata.EMail = txtfstemail.Text;
tcdata.CellPhone = txtcellphone.Text;
tcdata.Address = txtaddress.Text;
tcdata.City = txtcity.Text;
tcdata.CreatedOn = System.DateTime.Now.Date;
tcdata.Rate = Convert.ToDecimal(txtrate.Text);
dc.tblcandidateDatas.InsertOnSubmit(tcdata);
dc.SubmitChanges();



Select Statement Using Linq in asp.net


int pid=Convert.ToInt32(Session["PartnerId"]); 
var candidates = from p in dc.tblcandidatedatas where p.PartnerId == pid select p;
grvCandidates.DataSource = candidates;
grvCandidates.DataBind();

 

1 comment:

  1. this is useful for entityframework learners...

    ReplyDelete

Comments

Search

Custom Search
Protected by Copyscape Plagiarism Software