Results 1 to 28 of 28

Thread: [Resolved] Return value of Stored Procedure

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member naruponk's Avatar
    Join Date
    Feb 2004
    Location
    Some where in the world
    Posts
    423

    Re: Return value of Stored Procedure

    "Arithmetic overflow converting expression to data type smalldatetime"

    I'm using a code which i posted really.

    Code:
    Parameters.Append .CreateParameter("RETURN", adInteger, adParamReturnValue)
    Is return value should be 1st parameter?

  2. #2

    Thread Starter
    Hyperactive Member naruponk's Avatar
    Join Date
    Feb 2004
    Location
    Some where in the world
    Posts
    423

    Re: Return value of Stored Procedure

    I have create new stored proc which is requires 1 parameter only (@A)

    VB Code:
    1. .Parameters.Append .CreateParameter("@A", adBigInt, adParamInput, , 1)
    2. .Parameters.Append .CreateParameter("@Result", adBigInt, adParamReturnValue)

    above code will give me that ""Stored Proc ... has too many agrument specific"


    VB Code:
    1. .Parameters.Append .CreateParameter("@Result", adBigInt, adParamReturnValue)

    This will give me that " ... @A not supplied"
    Am i giving incorrect format?

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Return value of Stored Procedure

    I'm pretty sure that the RETURN {int} T-SQL command does not return that value in the PARAMETER collection.

    I cannot find backup for this in MSDN - I've got a good ADO book at work that I'll check in 30 minutes...

    Why are you so stuck on using RETURN {int} and not simply creating a list of INPUT and OUTPUT parameters? My example showed how to do that quite easily.

    The error you keep saying you are getting sounds more like a VB/ADO side error - that the object is not properly created and the SPROC isn't even executing.

    BTW - we decided at the start of our development project in VB/ADO/SQL that using LONG (VB) and INT (SQL) was the only integer style we would support. DATETIME also - no small datetime. Supporting lots of different datatypes in the PARAMETER logic is too complex.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    Re: Return value of Stored Procedure

    Quote Originally Posted by szlamany
    I'm pretty sure that the RETURN {int} T-SQL command does not return that value in the PARAMETER collection.

    I cannot find backup for this in MSDN - I've got a good ADO book at work that I'll check in 30 minutes...

    Why are you so stuck on using RETURN {int} and not simply creating a list of INPUT and OUTPUT parameters? My example showed how to do that quite easily.

    The error you keep saying you are getting sounds more like a VB/ADO side error - that the object is not properly created and the SPROC isn't even executing.

    BTW - we decided at the start of our development project in VB/ADO/SQL that using LONG (VB) and INT (SQL) was the only integer style we would support. DATETIME also - no small datetime. Supporting lots of different datatypes in the PARAMETER logic is too complex.
    I agree with the OUTPUT parameters idea szlamany - sorry missed that bit in your previous post when I posted this:
    Quote Originally Posted by PilgrimPete
    ...though I generally lean towards using an output parameter to return data values, and save the adParamReturnValue parameter to return the success (or otherwise) of my proc...
    naruponk - the adParamReturnValue parameter has to be the first you add to the parameters collection in the VB code, otherwise you will get the error you report.

  5. #5

    Thread Starter
    Hyperactive Member naruponk's Avatar
    Join Date
    Feb 2004
    Location
    Some where in the world
    Posts
    423

    Re: Return value of Stored Procedure

    Ok .... look works
    Thanks for ideas & helps guys

Posting Permissions

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



Click Here to Expand Forum to Full Width