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
Priyanka Singh
685
1.4k
683k
Error in Updation of data in gridview.
Apr 22 2019 5:33 AM
private bool UpdateEmployee(GridViewRow row)
{
int id = (int)gvEmployee.DataKeys[row.RowIndex].Value;
String firstName = ((TextBox)row.Cells[0].Controls[0]).Text;
String lastName = ((TextBox)row.Cells[0].Controls[0]).Text;
String position = ((TextBox)row.Cells[0].Controls[0]).Text;
String team = ((TextBox)row.Cells[0].Controls[0]).Text;
if ((firstName ?? lastName ?? position ?? team) != String.Empty)
{
using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString))
{
string sql = @"update set employee set SET FirstName = @FirstName,LastName = @LastName,Position = @Position,Team = @Team WHERE Id = @Id";
using (SqlCommand cmd = new SqlCommand(sql, con))
{
con.Open();
cmd.Parameters.AddWithValue("@FirstName", firstName);
cmd.Parameters.AddWithValue("@LastName", lastName);
cmd.Parameters.AddWithValue("@Position", position);
cmd.Parameters.AddWithValue("@Team", team);
cmd.Parameters.AddWithValue("@id", id);
cmd.ExecuteNonQuery();
}
}
return true;
}
return false;
}
I get this error while updation of data in gridview.
Reply
Answers (
1
)
how to code a back button on web forms ?
Swagger custom route in Asp.net web api