Results 1 to 2 of 2

Thread: Procedure or Function 'insauthor' expects parameter '@au_id', which was not supplied.

  1. #1
    Junior Member
    Join Date
    Oct 2008

    Procedure or Function 'insauthor' expects parameter '@au_id', which was not supplied.

    This is my code.i alway get the error Procedure or Function 'insauthor' expects parameter '@au_id', which was not supplied.pls help me out.i m a eginner in .net.

    This is my sp

    create procedure insauthor

    (@au_id int,@au_name nchar(10),@address nvarchar(50),@city nvarchar(50),@zip int,@phone int)

    Insert into author(au_id,au_name,address,city,zip,phone)



    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Data.SqlClient;

    public partial class _Default : System.Web.UI.Page
    SqlConnection con = new SqlConnection();

    string str = "Data Source=HOME;Initial Catalog=master;Integrated Security=True";

    protected void Page_Load(object sender, EventArgs e)

    //string str;
    //str = "Data Source=HOME;Initial Catalog=master;Integrated Security=True";

    con.ConnectionString = str;
    SqlCommand cmd = new SqlCommand();
    cmd.Connection = con;
    cmd = new SqlCommand("radha", con);
    cmd.CommandType = CommandType.StoredProcedure;

    SqlDataReader dr;
    dr = cmd.ExecuteReader();

    txtid.Text = dr["au_id"].ToString();
    txtnm.Text = dr["au_name"].ToString();
    txtadd.Text = dr["address"].ToString();
    txtph.Text = dr["phone"].ToString();
    txtzip.Text = dr["zip"].ToString();
    txtcity.Text = dr["city"].ToString();

    GridView1.DataSource = dr;


    protected void Button1_Click(object sender, EventArgs e)

    txtid.Text = "";
    txtnm.Text = "";
    txtadd.Text = "";
    txtph.Text = "";
    txtzip.Text = "";
    txtcity.Text = "";

    protected void Button2_Click(object sender, EventArgs e)

    con.ConnectionString = str;
    SqlCommand incmd = new SqlCommand();

    incmd = new SqlCommand("insauthor", con);

    incmd.CommandType = CommandType.StoredProcedure;
    incmd.Parameters.Add(" @au_id", SqlDbType.Int).Value = txtid.Text;

    incmd.Parameters.Add("@au_name",SqlDbType.NChar,10).Value= txtnm.Text;
    incmd.Parameters.Add("@address", SqlDbType .NVarChar,50).Value=txtadd.Text;
    incmd.Parameters.Add("@zip", SqlDbType.Int).Value=txtzip.Text;
    incmd.Parameters.Add("@phone",SqlDbType.Int).Value= txtph.Text;
    incmd.Parameters.Add("@city", SqlDbType.NVarChar,50).Value=txtcity.Text;

    int i;

    i = incmd.ExecuteNonQuery();
    if (i > 0)
    Response.Write("datasource addd successfully");
    Response.Write("operation failed");


  2. #2
    Junior Member
    Join Date
    May 2008

    Re: Procedure or Function 'insauthor' expects parameter '@au_id', which was not suppl

    what is radha in the code
    cmd = new SqlCommand("radha", con);
    pass there insauthor not radha

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.