2
Vote

Can we have a Database.AddReturnParameter method please?

description

<p>It would be very handy if the Database had an AddReturnParameter(DbCommand cmd, string paramName, System.Data.DbType dbType, int size) method.</p> <p>&nbsp;</p> <p>This would act just like AddOutParameter, except it would set the ParameterDirection to ReturnValue.</p> <p>&nbsp;</p> <p>Presently I seem to have to do the following which is a bit long winded, not very readable and requires parameters that are not relevant:</p> <p>&nbsp;</p> <p>Database.AddParameter(cmd, &quot;Return&quot;, System.Data.DbType.Int32, System.Data.ParameterDirection.ReturnValue, String.Empty, System.Data.DataRowVersion.Default, DBNull.Value);</p> <p>&nbsp;</p> <p>Seeing that you can only have one return parameter it should also be possible to come up with a method to get the value:</p> <p>object Database.GetReturnValue(DbCommand cmd)</p>

comments