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. Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

Scheduled Pinned Locked Moved ASP.NET
tutorial
9 Posts 5 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.
  • A Offline
    A Offline
    ajitkmr09
    wrote on last edited by
    #1

    Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

    L J V 3 Replies Last reply
    0
    • A ajitkmr09

      Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Supply the expected parameter. Given that you have not shown the line of code in question we have no way of knowing the answer. If it's a call to a system API method then take a look at the documentation to find out why. If it is code belonging to some other developer then ask them.

      speaking as ...

      A V 2 Replies Last reply
      0
      • A ajitkmr09

        Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

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

        That sounds like a sql parameter your supplying is null, empty or nothing. where @value is empty.

        value=@value,

        But like Richard said, you should walk your code, or show some code so we know what your taking about, or just Google it.

        A 1 Reply Last reply
        0
        • L Lost User

          Supply the expected parameter. Given that you have not shown the line of code in question we have no way of knowing the answer. If it's a call to a system API method then take a look at the documentation to find out why. If it is code belonging to some other developer then ask them.

          speaking as ...

          A Offline
          A Offline
          ajitkmr09
          wrote on last edited by
          #4

          OK I am supplying my code with stored proc here: My stored proc: USE [UniqueCorp] GO /****** Object: StoredProcedure [dbo].[uspUpdateUser_Step2] Script Date: 06/05/2012 12:12:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[uspUpdateUser_Step2] @userID uniqueidentifier, @Username nvarchar(50), @CompanyName nvarchar(50), @Address nvarchar(100), @Country nvarchar(50), @State nvarchar(50) = '', @City nvarchar(50) = '', @MobileNo nvarchar(50) = '', @TelephoneNo nvarchar(50) = '', @Password nvarchar(50) AS set nocount on; IF Exists (SELECT [ID] FROM dbo.Users WHERE [ID] = @userID) begin update dbo.Users set UserName=@Username, CompanyName=@CompanyName, [Address]=@Address, Country=@Country, [State]=@State, City=@City, Mobileno=@MobileNo, TelephoneNo=@TelephoneNo, Password=@Password WHERE [ID] = @userID end GO and the code behind is this....... public static int AddUpdateUser(Users user) { SqlParameter prmUserId = new SqlParameter("@userID", SqlDbType.UniqueIdentifier); prmUserId.Value = user.ID; SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50); prmUsername.Value = user.UserName; SqlParameter prmCompanyName = new SqlParameter("@CompanyName", SqlDbType.NVarChar, 50); prmUsername.Value = user.CompanyName; SqlParameter prmAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 100); prmUsername.Value = user.Address; SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 50); prmUsername.Value = user.Country; SqlParameter prmState = new SqlParameter("@State", SqlDbType.NVarChar, 50); prmUsername.Value = user.State; SqlParameter prmCity = new SqlParameter("@City", SqlDbType.NVarChar, 50); prmUsername.Value = user.City; SqlParameter prmMobileNo = new SqlParameter("@MobileNo", SqlDbType.Int, 50); prmUsername.Value = user.MobileNo; SqlParameter prmTelephoneNo = new SqlParameter("@TelephoneNo", SqlDbType.Int, 50); prmUsername.Value = user.TelephoneNo; SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50); prmUsername.Value = user.Password; return DataAccessObject.Execute("uspUpdateUser_Step2",prmUserId, prmUsername

          L 1 Reply Last reply
          0
          • J jkirkerx

            That sounds like a sql parameter your supplying is null, empty or nothing. where @value is empty.

            value=@value,

            But like Richard said, you should walk your code, or show some code so we know what your taking about, or just Google it.

            A Offline
            A Offline
            ajitkmr09
            wrote on last edited by
            #5

            OK I am supplying my code with stored proc here: My stored proc: USE [UniqueCorp] GO /****** Object: StoredProcedure [dbo].[uspUpdateUser_Step2] Script Date: 06/05/2012 12:12:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[uspUpdateUser_Step2] @userID uniqueidentifier, @Username nvarchar(50), @CompanyName nvarchar(50), @Address nvarchar(100), @Country nvarchar(50), @State nvarchar(50) = '', @City nvarchar(50) = '', @MobileNo nvarchar(50) = '', @TelephoneNo nvarchar(50) = '', @Password nvarchar(50) AS set nocount on; IF Exists (SELECT [ID] FROM dbo.Users WHERE [ID] = @userID) begin update dbo.Users set UserName=@Username, CompanyName=@CompanyName, [Address]=@Address, Country=@Country, [State]=@State, City=@City, Mobileno=@MobileNo, TelephoneNo=@TelephoneNo, Password=@Password WHERE [ID] = @userID end GO and the code behind is this....... public static int AddUpdateUser(Users user) { SqlParameter prmUserId = new SqlParameter("@userID", SqlDbType.UniqueIdentifier); prmUserId.Value = user.ID; SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50); prmUsername.Value = user.UserName; SqlParameter prmCompanyName = new SqlParameter("@CompanyName", SqlDbType.NVarChar, 50); prmUsername.Value = user.CompanyName; SqlParameter prmAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 100); prmUsername.Value = user.Address; SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 50); prmUsername.Value = user.Country; SqlParameter prmState = new SqlParameter("@State", SqlDbType.NVarChar, 50); prmUsername.Value = user.State; SqlParameter prmCity = new SqlParameter("@City", SqlDbType.NVarChar, 50); prmUsername.Value = user.City; SqlParameter prmMobileNo = new SqlParameter("@MobileNo", SqlDbType.Int, 50); prmUsername.Value = user.MobileNo; SqlParameter prmTelephoneNo = new SqlParameter("@TelephoneNo", SqlDbType.Int, 50); prmUsername.Value = user.TelephoneNo; SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50); prmUsername.Value = user.Password; return DataAccessObject.Execute("uspUpdateUser_Step2",prmUserId, prmUsername, prmCompanyName, prmAddress, prmCountry, prmState, prmCity, prmMobileNo, prmTelephoneNo,prmPassword); } Please help me the problem is still there... Procedure or function expects parameter @Username That was not supplied..... But i debug and confirm dat value is

            J 1 Reply Last reply
            0
            • L Lost User

              Supply the expected parameter. Given that you have not shown the line of code in question we have no way of knowing the answer. If it's a call to a system API method then take a look at the documentation to find out why. If it is code belonging to some other developer then ask them.

              speaking as ...

              V Offline
              V Offline
              Venkat Yerra
              wrote on last edited by
              #6

              we have to assign default value as NULL Create Procedure Sp_name @Input1 varchar(100)=NULL AS BEGIn //main Code END

              1 Reply Last reply
              0
              • A ajitkmr09

                Procedure or function expects parameter that was not supplied why it arise and if arise how to resolve it

                V Offline
                V Offline
                vvashishta
                wrote on last edited by
                #7

                The function or the Procedure is having some Parameters that are not been provided by your code while making call to that procedure. Note: Signature of Fucntion/Procedure while Defining and While Declaring the fucntion donot matches.

                - Happy Coding - Vishal Vashishta

                1 Reply Last reply
                0
                • A ajitkmr09

                  OK I am supplying my code with stored proc here: My stored proc: USE [UniqueCorp] GO /****** Object: StoredProcedure [dbo].[uspUpdateUser_Step2] Script Date: 06/05/2012 12:12:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[uspUpdateUser_Step2] @userID uniqueidentifier, @Username nvarchar(50), @CompanyName nvarchar(50), @Address nvarchar(100), @Country nvarchar(50), @State nvarchar(50) = '', @City nvarchar(50) = '', @MobileNo nvarchar(50) = '', @TelephoneNo nvarchar(50) = '', @Password nvarchar(50) AS set nocount on; IF Exists (SELECT [ID] FROM dbo.Users WHERE [ID] = @userID) begin update dbo.Users set UserName=@Username, CompanyName=@CompanyName, [Address]=@Address, Country=@Country, [State]=@State, City=@City, Mobileno=@MobileNo, TelephoneNo=@TelephoneNo, Password=@Password WHERE [ID] = @userID end GO and the code behind is this....... public static int AddUpdateUser(Users user) { SqlParameter prmUserId = new SqlParameter("@userID", SqlDbType.UniqueIdentifier); prmUserId.Value = user.ID; SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50); prmUsername.Value = user.UserName; SqlParameter prmCompanyName = new SqlParameter("@CompanyName", SqlDbType.NVarChar, 50); prmUsername.Value = user.CompanyName; SqlParameter prmAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 100); prmUsername.Value = user.Address; SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 50); prmUsername.Value = user.Country; SqlParameter prmState = new SqlParameter("@State", SqlDbType.NVarChar, 50); prmUsername.Value = user.State; SqlParameter prmCity = new SqlParameter("@City", SqlDbType.NVarChar, 50); prmUsername.Value = user.City; SqlParameter prmMobileNo = new SqlParameter("@MobileNo", SqlDbType.Int, 50); prmUsername.Value = user.MobileNo; SqlParameter prmTelephoneNo = new SqlParameter("@TelephoneNo", SqlDbType.Int, 50); prmUsername.Value = user.TelephoneNo; SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50); prmUsername.Value = user.Password; return DataAccessObject.Execute("uspUpdateUser_Step2",prmUserId, prmUsername

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  Firstly, this is a database problem and nothing to do with ASP.NET, so it is in the wrong forum. Secondly, you have given no indication where the error occurs. Thirdly, please use the correct <pre> tags around your code so it is readable, like this:

                  USE [UniqueCorp]
                  GO

                  /****** Object: StoredProcedure [dbo].[uspUpdateUser_Step2] Script Date: 06/05/2012 12:12:38 ******/
                  SET ANSI_NULLS ON
                  GO

                  ...

                  speaking as ...

                  1 Reply Last reply
                  0
                  • A ajitkmr09

                    OK I am supplying my code with stored proc here: My stored proc: USE [UniqueCorp] GO /****** Object: StoredProcedure [dbo].[uspUpdateUser_Step2] Script Date: 06/05/2012 12:12:38 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[uspUpdateUser_Step2] @userID uniqueidentifier, @Username nvarchar(50), @CompanyName nvarchar(50), @Address nvarchar(100), @Country nvarchar(50), @State nvarchar(50) = '', @City nvarchar(50) = '', @MobileNo nvarchar(50) = '', @TelephoneNo nvarchar(50) = '', @Password nvarchar(50) AS set nocount on; IF Exists (SELECT [ID] FROM dbo.Users WHERE [ID] = @userID) begin update dbo.Users set UserName=@Username, CompanyName=@CompanyName, [Address]=@Address, Country=@Country, [State]=@State, City=@City, Mobileno=@MobileNo, TelephoneNo=@TelephoneNo, Password=@Password WHERE [ID] = @userID end GO and the code behind is this....... public static int AddUpdateUser(Users user) { SqlParameter prmUserId = new SqlParameter("@userID", SqlDbType.UniqueIdentifier); prmUserId.Value = user.ID; SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.NVarChar, 50); prmUsername.Value = user.UserName; SqlParameter prmCompanyName = new SqlParameter("@CompanyName", SqlDbType.NVarChar, 50); prmUsername.Value = user.CompanyName; SqlParameter prmAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 100); prmUsername.Value = user.Address; SqlParameter prmCountry = new SqlParameter("@Country", SqlDbType.NVarChar, 50); prmUsername.Value = user.Country; SqlParameter prmState = new SqlParameter("@State", SqlDbType.NVarChar, 50); prmUsername.Value = user.State; SqlParameter prmCity = new SqlParameter("@City", SqlDbType.NVarChar, 50); prmUsername.Value = user.City; SqlParameter prmMobileNo = new SqlParameter("@MobileNo", SqlDbType.Int, 50); prmUsername.Value = user.MobileNo; SqlParameter prmTelephoneNo = new SqlParameter("@TelephoneNo", SqlDbType.Int, 50); prmUsername.Value = user.TelephoneNo; SqlParameter prmPassword = new SqlParameter("@Password", SqlDbType.NVarChar, 50); prmUsername.Value = user.Password; return DataAccessObject.Execute("uspUpdateUser_Step2",prmUserId, prmUsername, prmCompanyName, prmAddress, prmCountry, prmState, prmCity, prmMobileNo, prmTelephoneNo,prmPassword); } Please help me the problem is still there... Procedure or function expects parameter @Username That was not supplied..... But i debug and confirm dat value is

                    J Offline
                    J Offline
                    jkirkerx
                    wrote on last edited by
                    #9

                    I'm just using this one as an example only, it's not the problem. The error message you got basically says that one of your parameters is null or nothing, and that a valid value is required in order to convert the value to a qualified parameter.

                    prmUsername.Value = user.Address; <- One of these values is null or nothing in your list of parameters, or is the wrong format for nvarchar.

                    If you wrap your code in the try, catch, you can trap the sql exception message, and it will tell you which parameter is the issue. catch ex as sqlexception

                    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