- {
- 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.