c# - SP Executed Successfully But Data Not Updated -



c# - SP Executed Successfully But Data Not Updated -

i using telerik open access interaction mssql server 2012.

i have made stored procedure set isactive column of role table 0(false) , homecoming info of role isactive= 1 (true)

my role table has columns:

roleid(int), rolename(varchar(50)), aliasname(varchar(50)), isactive(bit).

my stored procedure:

alter procedure [spdeleterole] @role_id int begin update [role] set isactive = 0 roleid = @role_id select * [role] isactive = 1 order rolename end

i phone call sp in application below:

public list<roledto> deleterole(int roleid) { oaparameter oaparameter = new oaparameter(); oaparameter.parametername = "role_id"; oaparameter.dbtype = system.data.dbtype.int32; oaparameter.value = roleid; list<roledto> rolelist = base.execwithstoreproceduregetdatawithparam("spdeleterole", oaparameter); homecoming automapper.mapper.map<list<roledto>>(rolelist); } public list<t> execwithstoreproceduregetdatawithparam(string query, oaparameter parameters) { var queryresult = dbcontext.executequery<t>(query, commandtype.storedprocedure, parameters); dbcontext.dispose(); homecoming queryresult.tolist(); }

now problem works fine. when refresh page, role inactivated comes in list.

i checked through debugging list comes sp of active roles. refresh page role inactivated roles comes 1 time again in list. have verified sp executing in mssql server , works fine.

issue:

may should write dbcontext.savechanges() before dispose dbcontext?

c# sql-server asp.net-mvc-5 telerik-mvc telerik-open-access

Comments