Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. RE-Drop Down List Error

RE-Drop Down List Error

Scheduled Pinned Locked Moved ASP.NET
databasehelpsql-servercomsysadmin
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11127370
    wrote on last edited by
    #1

    HI, I am getting the following Errors,while inserting drop down list values in sql server database ERROR: Server Error in '/Online_Book_Shopping' Application. Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Source Error: Line 60: cmd.Parameters.Add(password); Line 61: con.Open(); Line 62: int i= cmd.ExecuteNonQuery(); Line 63: con.Close(); Line 64: } Source File: e:\Vijaya\Online_Book_Shopping\SignUp.aspx.cs Line: 62 How to solve this???Please Help??? This is my code: aspx.cs:- protected void btnn_Click(object sender, EventArgs e) { string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { SqlCommand cmd = new SqlCommand("spRegisteruser", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter name = new SqlParameter("@name", txtusername.Text); SqlParameter mobile = new SqlParameter("@mobile", txtmobilenumber.Text); SqlParameter password = new SqlParameter("@password", txtpassword.Text); SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value); cmd.Parameters.Add(name); cmd.Parameters.Add(dropdown); cmd.Parameters.Add(mobile); cmd.Parameters.Add(password); con.Open(); int i= cmd.ExecuteNonQuery(); con.Close(); } Sql table:- Create Table dbo.RegisteredUsers ( ID int identity Primary Key, Name nvarchar(20), Country_Name nvarchar(30), Mobile_No bigint, [Password] nvarchar(20) ) Go This is storedprocedure:- Alter Proc spRegisteruser @Name nvarchar(20), @countryname nvarchar(30), @mobile bigint,

    J J 2 Replies Last reply
    0
    • U User 11127370

      HI, I am getting the following Errors,while inserting drop down list values in sql server database ERROR: Server Error in '/Online_Book_Shopping' Application. Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Source Error: Line 60: cmd.Parameters.Add(password); Line 61: con.Open(); Line 62: int i= cmd.ExecuteNonQuery(); Line 63: con.Close(); Line 64: } Source File: e:\Vijaya\Online_Book_Shopping\SignUp.aspx.cs Line: 62 How to solve this???Please Help??? This is my code: aspx.cs:- protected void btnn_Click(object sender, EventArgs e) { string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { SqlCommand cmd = new SqlCommand("spRegisteruser", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter name = new SqlParameter("@name", txtusername.Text); SqlParameter mobile = new SqlParameter("@mobile", txtmobilenumber.Text); SqlParameter password = new SqlParameter("@password", txtpassword.Text); SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value); cmd.Parameters.Add(name); cmd.Parameters.Add(dropdown); cmd.Parameters.Add(mobile); cmd.Parameters.Add(password); con.Open(); int i= cmd.ExecuteNonQuery(); con.Close(); } Sql table:- Create Table dbo.RegisteredUsers ( ID int identity Primary Key, Name nvarchar(20), Country_Name nvarchar(30), Mobile_No bigint, [Password] nvarchar(20) ) Go This is storedprocedure:- Alter Proc spRegisteruser @Name nvarchar(20), @countryname nvarchar(30), @mobile bigint,

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      The error:

      Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied.

      Your code:

      SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value);

      Did you see it now? You have set a parameter named @country instead of @countryname.

      Z 1 Reply Last reply
      0
      • U User 11127370

        HI, I am getting the following Errors,while inserting drop down list values in sql server database ERROR: Server Error in '/Online_Book_Shopping' Application. Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied. Source Error: Line 60: cmd.Parameters.Add(password); Line 61: con.Open(); Line 62: int i= cmd.ExecuteNonQuery(); Line 63: con.Close(); Line 64: } Source File: e:\Vijaya\Online_Book_Shopping\SignUp.aspx.cs Line: 62 How to solve this???Please Help??? This is my code: aspx.cs:- protected void btnn_Click(object sender, EventArgs e) { string constr = ConfigurationManager.ConnectionStrings["CS"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { SqlCommand cmd = new SqlCommand("spRegisteruser", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter name = new SqlParameter("@name", txtusername.Text); SqlParameter mobile = new SqlParameter("@mobile", txtmobilenumber.Text); SqlParameter password = new SqlParameter("@password", txtpassword.Text); SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value); cmd.Parameters.Add(name); cmd.Parameters.Add(dropdown); cmd.Parameters.Add(mobile); cmd.Parameters.Add(password); con.Open(); int i= cmd.ExecuteNonQuery(); con.Close(); } Sql table:- Create Table dbo.RegisteredUsers ( ID int identity Primary Key, Name nvarchar(20), Country_Name nvarchar(30), Mobile_No bigint, [Password] nvarchar(20) ) Go This is storedprocedure:- Alter Proc spRegisteruser @Name nvarchar(20), @countryname nvarchar(30), @mobile bigint,

        J Offline
        J Offline
        jsc42
        wrote on last edited by
        #3

        It looks like you have misnamed a parameter. I guess that

        Member 11161625 wrote:

        SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value);

        should be

        Member 11161625 wrote:

        SqlParameter dropdown = new SqlParameter("@countryname",DropDownList1.SelectedItem.Value);

        so that the parameter name in the Parameters collection matches the parameter name in the Stored Procedure.

        1 Reply Last reply
        0
        • J Jochen Arndt

          The error:

          Procedure or function 'spRegisteruser' expects parameter '@countryname', which was not supplied.

          Your code:

          SqlParameter dropdown = new SqlParameter("@country",DropDownList1.SelectedItem.Value);

          Did you see it now? You have set a parameter named @country instead of @countryname.

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          Incredible when the error message tells you exactly what the problem is. :-\ :thumbsup:

          There are two kinds of people in the world: those who can extrapolate from incomplete data. There are only 10 types of people in the world, those who understand binary and those who don't.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups