日期:2014-05-18  浏览次数:20801 次

超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大
超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小  
我就只是循环的把dt中的数据写入到表中  
写入数据是调用的util.UpdateData方法(该方法中有关闭数据库连接)  
循环的代码如下:  
for   (int   x   =   1;   x   <=   dt.Rows.Count   -   1;   x++)  
{  
c_id   =   dt.Rows[x][0].ToString();  
bnum   =   dt.Rows[x][1].ToString();  
t_type   =   GetTypeId(dt.Rows[x][2].ToString());  
plate   =   GetPlateId(dt.Rows[x][3].ToString());  
price   =   dt.Rows[x][4].ToString();  
stc   =   dt.Rows[x][5].ToString();  
wpro   =   dt.Rows[x][6].ToString();  
unit   =   GetUnitId(dt.Rows[x][7].ToString());  
other   =   dt.Rows[x][8].ToString();  
pic   =   dt.Rows[x][9].ToString();  
util.UpdateData( "insert   into   TempMateriel   values( ' "   +   c_id   +   " ', ' "   +   bnum   +   " ', ' "   +   t_type   +   " ', ' "   +   plate   +   " ', ' "   +   price   +   " ', ' "   +   stc   +   " ', ' "   +   wpro   +   " ', ' "   +   unit   +   " ', ' "   +   other   +   " ', ' "   +   pic   +   " ') ");  
}  

UpdateData代码如下:  
public   static   void   UpdateData(string   strSql)  
{  
m_cmd   =   new   SqlCommand(strSql,   GetConn());  
m_cmd.ExecuteNonQuery();  
CloseCn();  
}  

每次都有关数据库,为什还提示这个错呢?

------解决方案--------------------
多个conntion连接未关闭,尽量用完了就关