Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Thursday, December 01, 2011

Insertion into SharePoint List using SharePoint Linq

var context = new LinqSampleDataContext(SPContext.Current.Web.Url);
            EntityList<LoginItem> login_Insert =
context.GetList<LoginItem>("Login");
            LoginItem NewREc = new LoginItem()
{Title=txtUserName.Text,Password=txtPassWord.Text };
            login_Insert.InsertOnSubmit(NewREc);
            context.SubmitChanges();
            txtUserName.Text = "";
            txtPassWord.Text = "";
            this.Controls.Add(new LiteralControl("Insertion
Successful"));

No comments:

Post a Comment