You are here: Re: PLEASE PLEASE HELP - How can I get a return value from a SQL Stored Proc is ASP.NET? « MsSQL Server « IT news, forums, messages
Re: PLEASE PLEASE HELP - How can I get a return value from a SQL Stored Proc is ASP.NET?

Posted by othellomy on 12/01/06 03:23

Why are you using stored proc when you can use a function(s)? I always
thought the output parameter was a bit of a hack and clumsy to use.

jbonifacejr wrote:
> If you look at the top post you will see where I put the code I am
> using. I also tried to let people know what happened when I tried their
> suggestions. But, thanks for the advice...and I'll look at those SQL
> Books online.
>
> Jan
>
> Erland Sommarskog wrote:
> > jbonifacejr (jbonifacejr@hotmail.com) writes:
> > > Thank you for your help. Any chance you have a moment to help just a
> > > little more? Here is what I did, but I still can't access the value
> > > output by the stored proc...
> > >
> > > I removed the Return @sRetUPC line. I am guessing that I can rely on
> > > the set @sRetUPC line to set the value of the output parameter
> > >
> > >>From there, I appended the parameters in the ASP code...like this
> > > oSproc.Parameters.Append(oParam2)
> > > oSproc.Parameters.Append(oParam1)
> > > --originally I tried to do Param1 then Param2, but I got an error
> > > about the parameter
> > > --type being an output, so I just figured I had them in the wrong
> > > order because the
> > > --first parameter in the code was the output one.
> > >
> > > Then, I added the line oSproc.Execute()
> > > After that is:
> > > Dim res
> > > res = oSproc.Parameters.Item("sRetUPC").Value.toString()
> > >
> > > This is not working. Do you know how I can get access to the value of
> > > the parameter that is returned?
> >
> > Never say "not working" in newsgroup post with explaining what it
> > means. Do you get an unexpected result? An error message? Something
> > else?
> >
> > Since I don't even know how your code looks like right now, just two
> > notes:
> >
> > 1) Use parameter names with leading @. The underlying provider may
> > prefer that.
> >
> > 2) Use adParamInputOutput for the output value. T-SQL does not have any
> > true output-only parameters. (Save the return value, but there is a
> > separate enum value for return values as I recall.)
> >
> >
> > --
> > Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
> >
> > Books Online for SQL Server 2005 at
> > http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
> > Books Online for SQL Server 2000 at
> > http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация