Hi,
I inherited a web project from other programmer. I notice on my dev
machine every time I request a page in IE or FF the CPU jumps to 100%, all
utilized by asp_wp.exe.
I did some researches on the web, somebody suggests this could be due to
database connection not properly disposed. I happened to see the following
code snippet in my web project:
static public IDataReader GetRS(String Sql)
{
SqlConnection dbconn = new SqlConnection() ;
dbconn.Connecti onString = DB.GetDBConn();
dbconn.Open();
SqlCommand cmd = new SqlCommand(Sql, dbconn);
return cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion);
}
I don't see dbconn.Dispose( ) or cmd.Dispose() getting called. Is this a
problem? If it is, where should I put the cmd.Dispose() and
dbconn.Dispose( )?
TIA
I inherited a web project from other programmer. I notice on my dev
machine every time I request a page in IE or FF the CPU jumps to 100%, all
utilized by asp_wp.exe.
I did some researches on the web, somebody suggests this could be due to
database connection not properly disposed. I happened to see the following
code snippet in my web project:
static public IDataReader GetRS(String Sql)
{
SqlConnection dbconn = new SqlConnection() ;
dbconn.Connecti onString = DB.GetDBConn();
dbconn.Open();
SqlCommand cmd = new SqlCommand(Sql, dbconn);
return cmd.ExecuteRead er(CommandBehav ior.CloseConnec tion);
}
I don't see dbconn.Dispose( ) or cmd.Dispose() getting called. Is this a
problem? If it is, where should I put the cmd.Dispose() and
dbconn.Dispose( )?
TIA
Comment