Here is Asp.net button code

<asp:Button ID="Button2" runat="server" Text="Approved Job Request" CssClass="css_button" CommandName="ApplyButton" CommandArgument='<%#Eval("AId")%>' />

Here is C# code

 if (e.CommandName == "ApplyButton")
    {
        int userId = int.Parse(e.CommandArgument.ToString());

        SqlConnection con = new SqlConnection("Data Source=Mrunal;Initial Catalog=JobPortalDB;Integrated Security=True");

        String sql = "update AppliedJob set AApprove='yes' where AId=userId";
        SqlCommand cmd = new SqlCommand(sql,con);
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();
        Response.Redirect("~/ReqHome.aspx");
    }

With above code, getting error as

System.Data.SqlClient.SqlException: Invalid column name 'userId'

. What to do?

Related posts

Recent Viewed