Home All Groups Group Topic Archive Search About

Store Procedure return values to VB.net app

Author
28 Feb 2005 6:45 AM
Rudy

Hello All!

I have a SP that returns a int value as an alias called "returnvalue". I can
call the SP fine in my code.
conLog = New
SqlConnection("Server=localhost;uid=*****;pwd=*****;database=footbet")
        cmdLog = New SqlCommand("loginStore", conLog)

        cmdLog.CommandType = CommandType.StoredProcedure
        cmdLog.Parameters.IndexOf("@InUse")
            conLog.Open()
             cmdLog.ExecuteScalar()
             myMainfrm.Show()

        conLog.Close()

No I can look at my dataAdapter and preview my return value from my store
procedure.  So I believe the connection is just fine.  I just want to be able
to send that returnvalue to a text box in my program. So all I need is the
output the SP is giving me, and put that value in a textbox.
Can anybody point me in the right direction, and let me know what is the
best way of doing this?

As always, Thank you for your time.

Rudy

Author
28 Feb 2005 8:22 AM
Cor Ligthert
Are all your drivers up to date? click for free checkup

Author
28 Feb 2005 4:05 PM
Sahil Malik
Rudy,

Here is a slightly better link -
http://support.microsoft.com/kb/308049/EN-US/#3
Even though the above would work, you can also do an output parameter from
the s/proc.

- Sahil Malik
http://codebetter.com/blogs/sahil.malik/



Show quoteHide quote
"Rudy" <R***@discussions.microsoft.com> wrote in message
news:E49229DA-9783-4047-BA07-496A7FDA2A0D@microsoft.com...
> Hello All!
>
> I have a SP that returns a int value as an alias called "returnvalue". I
can
> call the SP fine in my code.
> conLog = New
> SqlConnection("Server=localhost;uid=*****;pwd=*****;database=footbet")
>         cmdLog = New SqlCommand("loginStore", conLog)
>
>         cmdLog.CommandType = CommandType.StoredProcedure
>         cmdLog.Parameters.IndexOf("@InUse")
>             conLog.Open()
>              cmdLog.ExecuteScalar()
>              myMainfrm.Show()
>
>         conLog.Close()
>
> No I can look at my dataAdapter and preview my return value from my store
> procedure.  So I believe the connection is just fine.  I just want to be
able
> to send that returnvalue to a text box in my program. So all I need is the
> output the SP is giving me, and put that value in a textbox.
> Can anybody point me in the right direction, and let me know what is the
> best way of doing this?
>
> As always, Thank you for your time.
>
> Rudy
Author
1 Mar 2005 1:00 AM
Robbe Morris [C# MVP]
The last ADO.NET code sample shows how to return @RETURN_VALUE

http://www.eggheadcafe.com/articles/20030729.asp

Show quoteHide quote
"Rudy" <R***@discussions.microsoft.com> wrote in message
news:E49229DA-9783-4047-BA07-496A7FDA2A0D@microsoft.com...
> Hello All!
>
> I have a SP that returns a int value as an alias called "returnvalue". I
> can
> call the SP fine in my code.
> conLog = New
> SqlConnection("Server=localhost;uid=*****;pwd=*****;database=footbet")
>        cmdLog = New SqlCommand("loginStore", conLog)
>
>        cmdLog.CommandType = CommandType.StoredProcedure
>        cmdLog.Parameters.IndexOf("@InUse")
>            conLog.Open()
>             cmdLog.ExecuteScalar()
>             myMainfrm.Show()
>
>        conLog.Close()
>
> No I can look at my dataAdapter and preview my return value from my store
> procedure.  So I believe the connection is just fine.  I just want to be
> able
> to send that returnvalue to a text box in my program. So all I need is the
> output the SP is giving me, and put that value in a textbox.
> Can anybody point me in the right direction, and let me know what is the
> best way of doing this?
>
> As always, Thank you for your time.
>
> Rudy
Author
1 Mar 2005 2:27 AM
Rudy
Thank you all, you have been very helpful!
I had no idea could be so straight forward.  Jeeeze!!
Thanks again for your time!!!

Rudy

Show quoteHide quote
"Robbe Morris [C# MVP]" wrote:

> The last ADO.NET code sample shows how to return @RETURN_VALUE
>
> http://www.eggheadcafe.com/articles/20030729.asp
>
> --
> 2005 Microsoft MVP C#
> Robbe Morris
> http://www.robbemorris.com
> http://www.learncsharp.net/home/listings.aspx
>
>
>
> "Rudy" <R***@discussions.microsoft.com> wrote in message
> news:E49229DA-9783-4047-BA07-496A7FDA2A0D@microsoft.com...
> > Hello All!
> >
> > I have a SP that returns a int value as an alias called "returnvalue". I
> > can
> > call the SP fine in my code.
> > conLog = New
> > SqlConnection("Server=localhost;uid=*****;pwd=*****;database=footbet")
> >        cmdLog = New SqlCommand("loginStore", conLog)
> >
> >        cmdLog.CommandType = CommandType.StoredProcedure
> >        cmdLog.Parameters.IndexOf("@InUse")
> >            conLog.Open()
> >             cmdLog.ExecuteScalar()
> >             myMainfrm.Show()
> >
> >        conLog.Close()
> >
> > No I can look at my dataAdapter and preview my return value from my store
> > procedure.  So I believe the connection is just fine.  I just want to be
> > able
> > to send that returnvalue to a text box in my program. So all I need is the
> > output the SP is giving me, and put that value in a textbox.
> > Can anybody point me in the right direction, and let me know what is the
> > best way of doing this?
> >
> > As always, Thank you for your time.
> >
> > Rudy
>
>
>

Bookmark and Share