c# - Calling SQL procedure multiple times takes excessive time -


c# code:

private void picinward_click(object sender, eventargs e) {      for(datarow dr in dtdata.rows)      {          updatelocation(dr["docid"].tostring(), convert.toint32(dr["siteid"].tostring()));      } }   private void updatelocation(string docid, int locid) {      try      {          arraylist sqlparameterarraylist = new arraylist();           string strqry = "updatedocloc";           sqlparameter sqpdocid = new sqlparameter("docid", sqldbtype.varchar);          sqpdocid.value = docid;          sqlparameterarraylist.add(sqpdocid);           sqlparameter sqplocid = new sqlparameter("locid", sqldbtype.int);          sqplocid.value = locid;          sqlparameterarraylist.add(sqplocid);           dbhelper.executestoredprocedure(strqry, sqlparameterarraylist);     }     catch(exception ex)     {          messagebox.show(ex.message, "alert", messageboxbuttons.ok, messageboxicon.error);     } } 

sql procedure:

create procedure updatedocloc @docid varchar(50), @locid int begin     update docmaster set siteid = @locid documentid = @docid      insert hsdocmaster(docid, locid, modifieddate, isdeleted)     value(@docid, @locid, getdate(), 0) end 

this sample code, relatively have huge procedure code has update multiple tables , insert values in other tables plus table has trigger fires on update. have update 1000 odd records , method of repeatedly calling procedure time consuming. there better way done reasonably faster?


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -