Monday, March 25, 2013

How to insert the multiple values using LINQ in asp.net


In previous posts we have seen  how to insert the data into data base using sql server in asp.net with c sharp.  Now  i will given an example to insert the multiple fields  using LINQ in asp.net.Here i have used USING  to maintain the scope of the patientinfo.
using (PatientInfo pf = new PatientInfo())
{
t_patientDetails objpd =new t_patientDetails()
objpd.Name = Name;
objpd.Mobile = Mobile;
objpd.OPNO = OPNO;
objpd.Date = DateTime.Now;
pf.t_patientDetails.InsertOnSubmit(objpd);
pf.SubmitChanges();
}

No comments:

Bel