asp.net mvc - Stored procedures with output parameters using SqlQuery in the DbContext API -
i coulndt return output parameter query,here codes
etentities en = new etentities(); var prm_totalrecords = new sqlparameter { parametername = "totalrow", sqldbtype=system.data.sqldbtype.int ,direction= parameterdirection.output }; var prm_start = new sqlparameter { parametername = "page", value = start, sqldbtype=system.data.sqldbtype.int }; var prm_sort= new sqlparameter { parametername = "msort", sqldbtype = system.data.sqldbtype.nvarchar, value = sort }; var prm_limit = new sqlparameter { parametername = "size", sqldbtype = system.data.sqldbtype.int, value = limit }; string sql = "sp_product_get_paging @size,@page,@msort,@totalrow out"; object[] parameters = new object[] { prm_limit,prm_start,prm_sort,prm_totalrecords}; var data = en.database.sqlquery<urun>(sql,parameters); // totalrecords = (int)prm_totalrecords.value;//here give null error totalrecords = 3; return data;
everrything work fine if set 3 totalrecords manually,but part gives me null error. totalrecords = (int)prm_totalrecords.value;
how can return value ,thank
Comments
Post a Comment