i have developed a web application asp.net C#.
on a button click i am connecting to the database which takes long time to execute. initially it use to timeout. now i increased the commondtimeout property ,
cmd.CommandTimeout = 500;
basically it processing of paygroups. time required depends on num of employess in that paygroup.
so my question is if 1 of paygroup requires less time to execute say 2 or 3 mins, will the connection sill be open for specified time in commandtimeout property?
if yes . can we estimate the processing time and set the time accordingly .
why dont you try out something like this
using (SqlConnection cn = new SqlConnection(connectionString))
{
//your codee to perform database operation
}
this will close your connection once your work get completed.
CommandTimeOut = 0
.SQL Profiler
can help you optimize your database queries. I assume you are using SQL Server