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

Update ListItem Using SharePoint Linq

var context = new LinqSampleDataContext(SPContext.Current.Web.Url);
            EntityList<LoginItem> login_Insert =
context.GetList<LoginItem>("Login");
            var query = from cs in login_Insert
                        where cs.Title.ToString() == txtUserName.Text
                        select new
                        {
                            cs.Title,
                            cs.Password
                        };
            var UpadteQuery = context.Login.SingleOrDefault(cs =>
cs.Title == txtUserName.Text);
            if (UpadteQuery != null)
            {
                UpadteQuery.Password = txtPassWord.Text;
                context.SubmitChanges();
            }
                this.Controls.Add(new LiteralControl("Updation
Sucessful"));

No comments:

Post a Comment