2
Answers

GridView

Smart    Lucky

Smart Lucky

13y
1.4k
1
Hi dudes
 I did not geting it can any one help me....?




 con.Open();
        LinkButton lbn = sender as LinkButton;
        TableCell tc = lbn.Parent as TableCell;
        GridViewRow grv = tc.Parent as GridViewRow;
        GridView2.EditIndex = grv.RowIndex;
     
        string query = "update product set=p_Name=@pname, Emp_id=@empid where id=@id  ";
        cmd = new SqlCommand(query,con);
        cmd.Parameters.AddWithValue("@pname",(Convert .ToInt32(id.Text)));
        cmd.Parameters.AddWithValue("@empid", name.Text);
        cmd.Parameters .AddWithValue("@id",(Convert .ToInt32 (empid.Text)));
        if (cmd.ExecuteNonQuery() > 0) // Excetion OCcured here Incorrect Syntax near '='
        {
            Label1.Visible = true;
            Label1.Text = "Updated Sucessfully";
        }else
        {
            Label1.Visible = true;
            Label1.Text = "Record is not updated";
        }

Answers (2)
Next Recommended Forum