TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Gagan Sikri
NA
1.6k
222k
Linq Update Query
Nov 17 2014 2:34 PM
I am using this code to update table record using linq. Please tell me what to do as code is executing but no changes are being made to database. Code is as follows:
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
{
bool temp = false; ;
nsmainDataContext stc = new nsmainDataContext();
nodeinfo tbl = stc.nodeinfos.Where(m => m.nodeid == Convert.ToInt32(DropDownList1.SelectedValue)).SingleOrDefault();
if(RadioButtonList1.SelectedItem==null)
{
Label3.Visible = true;
Label3.Text = "Please select a valid choice";
}
else
{
if(RadioButtonList1.SelectedIndex==1)
{
temp = true;
tbl.nodetstatus = temp;
}
else
if(RadioButtonList1.SelectedIndex==2)
{
temp = false;
tbl.nodetstatus = temp;
}
tbl.statuschangelog = System.DateTime.Now.ToString();
//stc.SubmitChanges();
Label3.Visible = true;
Label3.Text = "Status of node " + DropDownList1.SelectedValue + " successfully changed";
}
}
Reply
Answers (
4
)
C# LINQ
Linq to entity framework: how to get string match