问题描述
System.InvalidOperationException:超时已过期。
在从池中获取连接之前超时时间已过。
这可能是因为所有池连接都在使用中并且达到了最大池大小。
private void uploadDbButton_Click(object sender,EventArgs e) { Cursor.Current = Cursors.WaitCursor;
countLabel.Text = autoid("Olvasasok","olvasas_szama");
string query,itemVlaue = "";
SqlCommand cmd;
if(kiadas.Checked)
{
radio = "K";
}
else if (bevetelezes.Checked)
{
radio = "B";
}
if (inventoryList.Items.Count > 0)
{
for (int i = 0; i < inventoryList.Items.Count; i++)
{
connect = new SqlConnection(conStr);
DateTime time = DateTime.Now;
String format = "yyyy-MM-dd";
DateTime ido = DateTime.Now;
String forma = "HH:mm:ss";
itemVlaue = inventoryList.Items[i].Text;
query = "INSERT INTO Olvasasok (olvasas_szama,rfid_tag,datum,ido,irany)VALUES ('" + countLabel.Text +"','" + itemVlaue + "','" + DateTime.Now.ToString(format) +"','" + DateTime.Now.ToString(forma) + "','" + radio +"')";
cmd = new SqlCommand(query,connect);
if (connect.State == ConnectionState.Closed)
{
connect.Open();
}
cmd.ExecuteNonQuery();
}
connect.Close();
functionCallStatusLabel.Text = "Feltöltés sikerült...";
}
else
{
MessageBox.Show("Csatlakozz rá egy olvasóra...");
}
inventoryList.Items.Clear();
m_TagTable.Clear();
m_TagTotalCount = 0;
totalTagValueLabel.Text = "0(0)";
this.uploadDbButton.Enabled = false;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)