Delay in calls to stored procedure

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I'm running through a loop calling a stored procedure each time. I prepare
the SqlCommand before entering the loop and just change the param values in
the loop before each call to ExecuteNonQuery(). The problem I get is it's
taking anywhere from 1/4 - 1/2 second before each call is made. I verified
this using the SQL Profiler and comparing the start times of each call. The
start and complete times are the same so the SP is executing very fast.

What's even weirder is that this doesn't happen all the time. Some times it
runs very, very fast.

The application is being run on the database server and I'm using the IP
address in the ConnectionString.

The loop its self it pretty simple

foreach (Item i in Items)
{
int itemRow = dataview.Find(a string) // note this dataview contains
8800 records

if (itemRow == -1)
continue;

// assign param values
....

try
{
cmd.ExecuteNonQuery()
}
catch (Exception ex)
{
LogMsg...
}
}

Any suggestions would be greatly appreciated.

-Joe


.



Relevant Pages

  • Re: A question on python performance.
    ... def getValue(trend, param, per): ... thought maybe I could add a caller method to the trend class and I came up ... loop one. ...
    (comp.lang.python)
  • A question on python performance.
    ... def getValue(trend, param, per): ... thought maybe I could add a caller method to the trend class and I came up ... loop one. ...
    (comp.lang.python)
  • Re: Generalized Method of Moments
    ... fhandle = myfunction; %here I changed as response to ... don't know the stopping loop value of param since I want to estimate ...
    (comp.soft-sys.matlab)
  • Re: c:if test with dynamic variable
    ... xyz_3 and I want to test if these variable are passed as param ... name in loop. ... forexample.. ... where var generates xyz_1, xyz_2,xyz,_3 .. ...
    (comp.lang.java.programmer)
  • TimeOut Expired. Using Temporary tables
    ... I am iterating through these records in a WHILE Loop and performing certain business rules on these records. ... This entire processing is being done in a stored procedure which is being executed using ADO.NET's ExecuteNonQuery method. ... However after around 18 hrs of processing time i get a TimeOut error. ... Post Made from http://www.DotNetJunkies.com/newsgroups Our newsgroup engine supports Post Alerts, Ratings, and Searching. ...
    (microsoft.public.dotnet.framework.adonet)