Re: Another Parameter Question
- From: "Cowboy \(Gregory A. Beamer\)" <NoSpamMgbworld@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 4 Sep 2006 11:53:02 -0500
I find it easiest to use the full constructor than it is to set up
parameters and then configure them. It is also less error prone.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************************************************
Think outside the box!
*************************************************
"Stephen Lynch" <raider1raider@xxxxxxxxx> wrote in message
news:%cWKg.6867$SZ3.48@xxxxxxxxxxxxx
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
Here's part of my code. The @contributionID section is where I am
stuck, how do I declare the output parameter?
// Add Parameters to SPROC
OleDbParameter parameterCompanyId = new
OleDbParameter("@CompanyId", OleDbType.Integer, 4);
parameterCompanyId.Value = SystemUtils.GetUserID();
myCommand.Parameters.Add(parameterCompanyId);
OleDbParameter parameterPayPeriod = new
OleDbParameter("@PayPeriod", OleDbType.Date, 8);
parameterPayPeriod.Value = this.PayPeriod2.Text;
myCommand.Parameters.Add(parameterPayPeriod);
OleDbParameter parameterPlanYear = new
OleDbParameter("@PlanYear", OleDbType.Integer, 4);
parameterPlanYear.Value = this.PlanYear2.Text;
myCommand.Parameters.Add(parameterPlanYear);
OleDbParameter parameterContributionDate = new
OleDbParameter("@ContributionDate", OleDbType.Date, 8);
parameterContributionDate.Value =
this.ContributionDate2.Text;
myCommand.Parameters.Add(parameterContributionDate);
//Line that does not work
OleDbParameter parameterContributionID = new
OleDbParameter("@ContributionID", OleDbType.Integer, 4);
parameterContributionID.Direction =
ParameterDirection.Output
Thanks
.
- References:
- Another Parameter Question
- From: Stephen Lynch
- Another Parameter Question
- Prev by Date: Re: DataReader and Master-Detail
- Next by Date: Re: Parameter Help
- Previous by thread: Another Parameter Question
- Next by thread: Re: Another Parameter Question
- Index(es):
Relevant Pages
|
|