multiple usage errors:
- passing
DbType.Int32
/DbType.String
as the value rather than the data type - if you aren't passing a string value, it needs a hint for the length
- you should use
Execute
, notQueryMultiple
here - using the return of
Execute
to mean the return value of the stored procedure (that simply isn't how ADO.NET works; the return value there is theoretically the rows affected, but it is usually a meaningless number)
So:
dynamicParams.Add("rval", dbType: DbType.Int32,
direction: ParameterDirection.ReturnValue);
dynamicParams.Add("NEWNUMBER", dbType: DbType.String,
direction: ParameterDirection.Output, size: 100);
db.Execute("GetNextNumberTest", dynamicParams,
commandType: CommandType.StoredProcedure);
var rval = dynamicParams.Get<int>("rval");
var result = dynamicParams.Get<string>("NEWNUMBER");