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
While Updating gridview data,it shows an error.
Apr 19 2019 1:47 AM
{
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
;
}
It shows an error.Help me to resolve the problem.
Reply
Answers (
4
)
500.0 Internal Server Error
How to keep user logged in when i have a switch language