can not get parameter output

D

DotNetJunkies User

I run the following code in an aspx page. The problem is, I can not get the output parameter.
I use Data Access Application Block 2. The same works fine in Windows Form.
Somebody plz help.

SqlParameter [] arParms1 = new SqlParameter[8];
arParms1[0] = new SqlParameter("@MRID", SqlDbType.Int);
arParms1[0].Direction=ParameterDirection.Output;
arParms1[1] = new SqlParameter("@RequestFor", SqlDbType.SmallInt);
arParms1[1].Value=cmbFor.SelectedValue;
arParms1[2] = new SqlParameter("@RequestType", SqlDbType.SmallInt);
arParms1[2].Value=cmbType.SelectedValue;

SqlHelper.ExecuteNonQuery(dbConn, "MaterialRequestInsert", arParms1);
int MRID=arParms1[0].Value;


The SP goes like this:

CREATE PROCEDURE [MaterialRequestInsert]
(
@MRID int out,
@RequestFor smallint,
@RequestType smallint,
)
AS
SET NOCOUNT OFF;
insert into MaterialRequest
(RequestFor, RequestType)
Values(@RequestFor, @RequestType);

select @MRID=@@identity

GO
 
C

Cirrosi

From Microsoft:

The ExecuteNonQuery does not return any rows, any output parameters or
return values mapped to parameters are populated with data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top