我的项目运作完美;但它在这个函数中一直给我这个错误:超时已过期。从池中获取连接之前经过的超时时间。这可能是因为所有池连接都在使用中并且达到了最大池大小。'
public List<TransactionIssues> GetAllTransactions()
{
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = new SqlCommand();
List<TransactionIssues> transIssues = new List<TransactionIssues>();
command.CommandText = "issue_sp_getallunpostedissues";
command.CommandType = CommandType.StoredProcedure;
command.Connection = connection;
SqlDataReader rdrObj;
try
{
connection.Open();
rdrObj = command.ExecuteReader();
while (rdrObj.Read())
{
TransactionIssues issues = new TransactionIssues();
issues.requisitionNumber = rdrObj.GetString(0);
issues.transactionDate = rdrObj.GetDateTime(1);
//issues.expense_acccount.account_desc = rdrObj.GetString(2);
//issues.expense_acccount.index = rdrObj.GetInt16(3);
issues.inventory_acccount.index = rdrObj.GetInt32(2);
issues.inventory_acccount.account_desc = rdrObj.GetString(3);
issues.docNumber = rdrObj.GetString(4);
issues.docType = rdrObj.GetString(5);
issues.items = getTransItemByRquisition(rdrObj.GetString(4));
transIssues.Add(issues);
}
rdrObj.Close();
}
catch (Exception ex)
{
throw ex;
}
finally
{
connection.Close();
}