Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2006
    Posts
    4

    Unanswered: Procedure or function has too many arguments specified

    i'm trying to insert into db sql 2000 through a stored procedure .. i got this error " Procedure or function newuser has too many arguments specified "

    this is the procedure :



    ALTER PROCEDURE newuser

    (@username_1 [nvarchar](80),

    @email_2 [nvarchar](50),

    @password_3 [nvarchar](256),

    @Country_ID_4 [int],

    @city_id_5 [nvarchar](10),

    @gender_6 [nvarchar](50),

    @age_7 [int],

    @fname_8 [nvarchar](50),

    @lname_9 [nvarchar](50),

    @birthdate_10 [datetime])

    AS INSERT INTO [Brazers].[dbo].[users]

    ( [username],

    [email],

    [password],

    [Country.ID],

    [city.id],

    [gender],

    [age],

    [fname],

    [lname],

    [birthdate])


    VALUES

    ( @username_1,

    @email_2,

    @password_3,

    @Country_ID_4,

    @city_id_5,

    @gender_6,

    @age_7,

    @fname_8,

    @lname_9,

    @birthdate_10)







    & that 's the code in asp page :



    Dim param As New SqlClient.SqlParameter

    SqlConnection1.Open()

    param.ParameterName = "@username_1"

    param.Value = TextBox1.Text

    param.Direction = ParameterDirection.Input

    SqlCommand1.Parameters.Add(param)

    SqlCommand1.ExecuteNonQuery()







    plz .. waiting any solve for this problem immediately

  2. #2
    Join Date
    Oct 2006
    Posts
    4
    In your procedure have 10 arguments, the code in asp page also declare 10 parameters before run SqlCommand1.ExecuteNonQuery() command.

  3. #3
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    also you need to do this:

    SqlCommand1.CommandText = "newuser"

    if you haven't done that further up in your code. it's not in the VB you pasted so I assume you forgot it.

  4. #4
    Join Date
    Oct 2006
    Posts
    4
    Quote Originally Posted by minhtruc
    In your procedure have 10 arguments, the code in asp page also declare 10 parameters before run SqlCommand1.ExecuteNonQuery() command.

    so wt is the wrong in that .. i can't understand wt u mean

  5. #5
    Join Date
    May 2004
    Location
    Seattle
    Posts
    1,313
    The point is that this sproc takes 10 args (none of which are optional) and you are only passing 1 arg.

    You need to pass all 10.

  6. #6
    Join Date
    Oct 2006
    Posts
    4

    .......

    for sure i pass all the 10 arguments befor excute non query
    the error is still there & i got crazy of it ... do u think it it's error in db or somthing ..?

  7. #7
    Join Date
    Aug 2004
    Location
    Pune,India
    Posts
    94
    there of few things you need to check:
    1. make sure you are psssing right S-Proc name to your command object.
    2. You are passing right number of parameters to the stored proc.
    3. You're passing these parameters in proper order.

    do this and i think you will get the solution.

    Hope this helps.
    In GOD we believe. Everything else we Test!

  8. #8
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    This does not appear to be an error in the procedure, but rather an error in your ASP code. Therefore I am moving this thread to the ASP forum where I hope somebody will be able to provide an answer.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •