Return Value from SqlCommand in ASP.Net

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Adhik

    #1

    Return Value from SqlCommand in ASP.Net

    Hi,

    My application has frontend in ASP.Net, middle tier in vb.Net and backend
    SQL Server.

    I have created one function in Middle tier for adding any records by passing
    Procedure Name and Parameters Array.
    Here i am using SQLCommnd Object to Call procedure, to take return value
    i.e. Id or flag of successful insert/update, I have added one
    @retVal as integer as OUTPUT parameter. But if i didn't declare this @retVal
    parameter in Procedure as OTUPUT parameter, then it gives error.

    Before this is ASP and VB as middle tier, I dont need to declare output
    parameter in procedure, just i have to call retrun at end of procedure which
    retrun the reqired value.

    What should i have to do this same to work with ASP.Net.

    Hoping some solution.

    Regards
    Adhik


  • Patrick Steele [MVP]

    #2
    Re: Return Value from SqlCommand in ASP.Net

    In article <eu$6JedTDHA.15 56@TK2MSFTNGP10 .phx.gbl>, adhik@hotpop.co m
    says...[color=blue]
    > Hi,
    >
    > My application has frontend in ASP.Net, middle tier in vb.Net and backend
    > SQL Server.
    >
    > I have created one function in Middle tier for adding any records by passing
    > Procedure Name and Parameters Array.
    > Here i am using SQLCommnd Object to Call procedure, to take return value
    > i.e. Id or flag of successful insert/update, I have added one
    > @retVal as integer as OUTPUT parameter. But if i didn't declare this @retVal
    > parameter in Procedure as OTUPUT parameter, then it gives error.
    >
    > Before this is ASP and VB as middle tier, I dont need to declare output
    > parameter in procedure, just i have to call retrun at end of procedure which
    > retrun the reqired value.
    >
    > What should i have to do this same to work with ASP.Net.[/color]

    See:

    "HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET"
    http://support.microsoft.com/default...b;en-us;308049

    --
    Patrick Steele
    Microsoft .NET MVP

    Comment

    Working...