sql server - Issue with timeout within TransactionScope in C# -


i have insert method works fine smaller data sets, once data sets beyond size , method times out, regardless of set in initial transaction scope.

the insert methods in code use simple stored sql procedures called "executenonquery"

my code looks (fluff removed):

     public void method()      {       using (transactionscope testscope = new transactionscope(transactionscopeoption.required, new system.timespan(1, 25, 0)))                     {                      timedb.insert(var.time);                      codedb.insert(var.code);                      foreach (variable var in listofvariables)                             {                              namedb.insert(var.value);                              }                      testscope.complete();                     }        } 

i assume issue has command time out rather scope time out, since code works fine smaller datasets.... if that's case there way change command time out without modify machine.config (or other .config files, i'm strictly banned modifying them changing values mess rest of program)

if issue isn't specific command time outs, causing it? said code works fine anywhere between 8000-15000 inserts (depending on timeout set in our connectionstring "connect timeout value set in our program config file can modify test purposes cannot change value within), larger , crashes.

also i'm sure it's not scope timeout value task timesout after few minutes, no near 1 hour , 25 minutes set in transactionscope

thank in advance taking time me fix issue.

edit:

by request i've added example of 1 of insert methods called namedb.insert method (fluff removed, note actual insert method sub method of namedb.insert method, , actual loop in namedb.insert method . used namedb....etc lessen fluff. )

  public int32 insert(hashtable serdata, datado data)         {             int numaffected = 0;              idataparameter[] parameters =                      {                                                this.helper.getparameter("@text", data.text),                         this.helper.getparameter("@creationdt", ((data.creationdate == datetime.minvalue)                          ? convert.dbnull : data.creationdate)),                                              this.helper.getparameter("@typeid", data.typeid),                                                this.helper.getparameter("@keyid", dbtype.int32, 4, parameterdirection.output)                     };              numaffected = this.helper.executenonquery(this.connectionstring, "insertdata", parameters);              if (numaffected > 0)                 return convert.toint32(parameters[parameters.length - 1].value);              return 0;         } 

i think can set command timeout in code also: dbcommand, if using command. , dbcommand not inherit transaction scope or connection string , have set manually.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -