Re: Output Parameter Help



Stephen Lynch wrote:
I am running a stored procedure via code but need help with the sytax
for the output parameter:

When I run this it works in SQL:


USE DataInput

GO

DECLARE @MyIdent int



EXEC a_spAppendNewContributionID

@CompanyId=1000,

@PayPeriod="8/12/2006",

@PlanYear=2006,

@ContributionDate="08/25/2006",

@ContributionID = @MyIdent OUTPUT



SELECT @MyIdent AS IdentityValue

SELECT * FROM MassPost


That doesn't help. What we really need to see is the CREATE PROCEDURE
statement so we can see the datatypes of the parameters. Also, we would
want to verify that your procedure contains a "SET NOCOUNT ON" statement
so that the informational "x records effected" statements will be
suppressed, preventing them from interfering with the retrieval of the
output parameter values.


Here's part of my code in asp. The @contributionID section is where
I am stuck, how do I declare the output parameter?

// Add Parameters to SPROC

OleDbParameter parameterCompanyId = new

Oops
There was no way for you to know it (except maybe by browsing through
some
of the previous questions in this newsgroup before posting yours -
always a
recommended practice) , but this is a classic ADO newsgroup. ADO.Net
bears
very little resemblance to classic ADO so, while you may be lucky enough
to
find a dotnet-knowledgeable person here who can answer your question,
you
can eliminate the luck factor by posting your question to a group where
those dotnet-knowledgeable people hang out. I suggest
microsoft.public.dotnet.framework.adonet.

If you have a web server, you might want to try out my code generator
page:
http://common.mvps.org/barrowsb/DotNet_sp_code_generator.zip

Even if you don't have a web server, you can probably migrate the code
to a windows form.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


.



Relevant Pages

  • Re: Another Parameter Question
    ... @ContributionID = @MyIdent OUTPUT ... The @contributionID section is where I am ... how do I declare the output parameter? ... OleDbParameter parameterCompanyId = new ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Another Parameter Question
    ... @ContributionID = @MyIdent OUTPUT ... The @contributionID section is where I am ... how do I declare the output parameter? ... OleDbParameter parameterCompanyId = new ...
    (microsoft.public.dotnet.framework.adonet)
  • Help with Output Parameter Statement
    ... I am running a stored procedure via code but need help with the sytax for ... the output parameter as mine is wrong, Sorry, but I am just learning. ... OleDbParameter parameterContributionID = new ... @ContributionId int OUTPUT ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Strange behavior with SQL text field and ADO Parameter....a challenge for the experts (Aaron Ber
    ... The first thing I see is the lack of SET NOCOUNT ON in your stored ... your procedure is returning a resultset containing ... > When I run the code above the returned output parameter in VB is ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Stored procedure to return record set
    ... the output parameter. ... >> Please reply to the newsgroup. ... This email account is my spam trap so I ...
    (microsoft.public.sqlserver.programming)