public static SqlDataReader ExecuteReader(string connString, CommandType cmdType, string cmdText, params SqlParameter[] cmdParms) { SqlCommand cmd = new SqlCommand(); SqlConnection conn = new SqlConnection(connString); try { PrepareCommand(cmd, conn, null, cmdType, cmdText, cmdParms); SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection); cmd.Parameters.Clear(); return rdr;
} catch (Exception ex) { conn.Close(); throw ex; } }
怎样修改好呢,现在发现经常有超时的现象,数据库连接池已满的现象
10 回答
holdtom
TA贡献1805条经验 获得超10个赞
SqlDataReader rdr;
try
{
......
}
catch (Exception ex)
{
throw ex;
}
finally
{
conn.Close();
}
return rdr;
- 10 回答
- 0 关注
- 457 浏览
添加回答
举报
0/150
提交
取消