You need to change the
paramNewReqID.Direction = ParameterDirection.ReturnValue
to
paramNewReqID.Direction = ParameterDirection.Output
since you declared it as an output parameter in stored procedure.
Kiran.
-----Original Message-----
From: Eliezer Broder [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 03, 2005 5:03 PM
To: [email protected]
Subject: [AspNetAnyQuestionIsOk] SQL error: "Procedure 'Requistions_add'
expects parameter '@RequistionId', which was not supplied."
I've got a SQL Server 2000 stored procedure called 'Requistions_add'
that takes a whole bunch of input parameters and one output parameter:
CREATE procedure Requistions_add
( @RequistionId int OUTPUT
, @CreatedTs datetime
, @PersonId_Creator smallint
, @OrganizationId_Charge smallint
, @OrganizationId_Install smallint
, @FacilityId_Install smallint
, @BusinessNeedDescr varchar( 255 )
, @ContactLastName varchar( 255 )
, @ContactFirstName varchar( 255 )
, @Phone_Contact varchar( 255 )
, @Email_Contact varchar( 255 )
, @PCScope varchar( 255 )
, @PCName varchar( 255 )
, @HelpDeskTicket varchar( 255 )
, @InstallationInstructions text
)
[ etc ...]
The VB.NET code looks like this:
Dim cmSaveReq As New SqlCommand
cmSaveReq.Connection = cnDeliveryAndInstallation
cmSaveReq.CommandType = CommandType.StoredProcedure
cmSaveReq.CommandText = "dbo.Requistions_add"
'set up output parameter
Dim paramNewReqID As New SqlParameter
paramNewReqID.ParameterName = "@RequistionId"
paramNewReqID.SqlDbType = SqlDbType.Int
paramNewReqID.Direction = ParameterDirection.ReturnValue
cmSaveReq.Parameters.Add(paramNewReqID)
cmSaveReq.Parameters.Add("@CreatedTs", Now)
cmSaveReq.Parameters.Add("@PersonId_Creator", personID.Text)
cmSaveReq.Parameters.Add("@OrganizationId_Charge",
costCenterDeptCharged.Text)
[ some more input params added ]
If cnDeliveryAndInstallation.State = ConnectionState.Closed
Then
cnDeliveryAndInstallation.Open()
Dim intNewReqID As Integer = cmSaveReq.ExecuteScalar
On that last line of ExecuteScalar - I get that error (see subject
line, please). What is going on here? I AM supplying it with the
parameter!
Any help would be more than appreciated!
Thanks,
Eliezer
________________________________
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]
cribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/