You add a return value parameter, for example:
For SqlCommand:
parameters.Add("@retValue", DbType.Int32, ParameterDirection.ReturnValue);
For EL, you need to use db.AddParameter () and specify ParameterDirection.ReturnValue.
In addition, as long as the row counter is enabled in your database, you can use the result from ExecuteNonQuery (), which tells you how many rows were affected in update / insert / delete / etc, for the update to be performed. This way you could handle if the affected rows were 0 (could not be found)
source share