Click here to Skip to main content
15,569,774 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Error: : No overload for method 'dispdata' takes '0' arguments


C#
 public void dispdata(string catid)
    {
       
      
            con.Open();

            SqlCommand cmd = new SqlCommand(" select catname,catdesc from categoryDetail where catid=@catid ", con);
            cmd.Parameters.AddWithValue("@catid", catid);
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                txtcname.Text = dr["catname"].ToString();
                txtcatdesc.Text = dr["catdesc"].ToString();
            }
            con.Close();          

    }
protected void btnsubmit_Click(object sender, ImageClickEventArgs e)
    {
        SqlCommand cmd = new SqlCommand();
        con.Open();
        string str = "update categorydetail set catname='" + txtcname.Text + "' where catdesc='" + txtcatdesc.Text + "'";
        cmd = new SqlCommand(str, con);
        cmd.ExecuteNonQuery();
        Response.Redirect("CategoryDetail.aspx?Edit=Yes");
        con.Close();
        dispdata();

}
Posted
Updated 26-Jul-12 21:00pm
v5
Comments
Sebastian T Xavier 27-Jul-12 1:29am    
Please post your code of method call

1 solution

You need to pass a string value to catid, when you call dispdata method.

Update: Hope you have corrected your code as follows

C#
protected void btnsubmit_Click(object sender, ImageClickEventArgs e)
    {
        SqlCommand cmd = new SqlCommand();
        con.Open();
        string str = "update categorydetail set catname='" + txtcname.Text + "' where catdesc='" + txtcatdesc.Text + "'";
        cmd = new SqlCommand(str, con);
        cmd.ExecuteNonQuery();
        Response.Redirect("CategoryDetail.aspx?Edit=Yes");
        con.Close();
        dispdata("ANY STRING VALUE");

}



Regards
Sebastian
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900