关于连接回收的问题
以下代码,因为没有显式的Dispose连接,return后,连接是否会立刻自动释放?Broker broker = BrokerFactory.CreateBroker("xxx");
try
{
string sql = "select xxx from xxx";
DataTable table = broker.ExecuteQuery(sql, new object[] { usrtype });
if (table.Rows.Count > 0)
{
return table.Rows[0]["aaa"].ToString();
}
return string.Empty;
}
catch (Exception ex)
{
throw new Exception(ex);
}
finally
{
broker.Dispose();
}