How get an sproc OUTPUT parameter?

M

mscertified

I hope this is the right forum. I'm a complete beginner at .NET and C#.
This is some code in a web service that calls an sproc that has an OUTPUT
parameter. Can anyone tell me how to code getting the output parameter? The
commented out code is a failed attempt. Thanks.

try
{
Database db = DatabaseFactory.CreateDatabase("SqlServices");
System.Data.Common.DbCommand dbCommand =
db.GetStoredProcCommand("MonthlyPaymentList");

db.AddInParameter(dbCommand, "AsOfDate", DbType.DateTime,
AsOfDate);
db.AddOutParameter(dbCommand, "ErrorId", DbType.Int64, 16);

DataSet ds = db.ExecuteDataSet(dbCommand);

//int errorId = (int)db.GetParameterValue(dbCommand,
"ErrorId");
//if (errorId != 0)
//{
// return null;
//}

return ds;
}
 
M

Mark Stevens

db.AddOutParameter(dbCommand, "ErrorId", DbType.Int64, 16);

DataSet ds = db.ExecuteDataSet(dbCommand);

//int errorId = (int)db.GetParameterValue(dbCommand,
"ErrorId");

Just a thought but doesn't int map to Int32 and not Int64?

Regards,
Mark
--
|\ _,,,---,,_ A picture used to be worth a
ZZZzzz /,`.-'`' -. ;-;;, thousand words - then along
|,4- ) )-,_. ,\ ( `'-' came television!
'---''(_/--' `-'\_)

Mark Stevens (mark at thepcsite fullstop co fullstop uk)

This message is provided "as is".
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top