Problem description:
Stored Procedure:
Alter procedure dbo. p_PurchaseSearch (@ fromdateDATETIME, @ todateDATETIME, @ notpayINT, @ idINT, @ custormerINT, @ istaxINT, @ specINT, @ companyINT, @ itemCountINT = 0 OUTPUT, @ pageIndexINT = 1 OUTPUT, @ pageSizeINT = 20 OUTPUT, @ runTimeINT = 0 OUTPUT)...
Import the stored procedure into the. edmx model. If a returned result set exists, a complex type is created.
When called in the. cs file:
ObjectParameter itemCount = new ObjectParameter ("itemCount", 10 );
ObjectParameter pageIndex = new ObjectParameter ("pageIndex", 1 );
ObjectParameter pageSize = new ObjectParameter ("pageSize", 20 );
ObjectParameter runTime = new ObjectParameter ("runTime", 10 );
Var _ result = dhhs. P_PurchaseSearch (fromdate, todate, notpay? 1: 0, id, customer, istax, spec, company, itemCount, pageIndex, pageSize, runTime). ToList ();
After the call, the OUTPUT value cannot be returned, that is, the input value does not change. After debugging, the stored procedure is found to be correct, and the background code is checked. It is found that the interface class controller is initialized previously:
DhhsdbEntities dhhs = newdhhsdbEntities ();
Fixed the problem:
ORZ can be instantiated before each action call. It is similar to the previous static method that makes different users talk about the same bug.