如何解决此错误超时已过期。操作完成之前经过的超时时间或服务器没有响应。 [英] how to solve this error Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
本文介绍了如何解决此错误超时已过期。操作完成之前经过的超时时间或服务器没有响应。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
我尝试使用asp.net从mysql数据库中获取记录,但我面临上述错误
这是我的代码
hi
I am try to fetch record from mysql database using asp.net ,but i face above error
this is my code
string str = "SELECT accountmaster.BANKCODE, accountmaster.BRANCHCODE, accountmaster.AccountType, accountmaster.AccountSubType, accountmaster.ACCOUNTNO,accountmaster.ACCOUNTID, chequedetailstable.ChequeNumber, chequedetailstable.ChequeStatus, chequedetailstable.PayCancelDate,accountmaster.OPERATORID, accountmaster.OFFICERID,'0001'as instrcode, chequedetailstable.TransactionCode FROM accountmaster INNER JOIN chequedetailstable ON accountmaster.ACCOUNTNO = lpad(substring(chequedetailstable.AccountId,4,12), 7, 0) where accountmaster.AccountSubType in('100','200','501')";
MySqlCommand cmdstr = new MySqlCommand(str, conn);
cmdstr.CommandTimeout = 150;
MySqlDataAdapter da = new MySqlDataAdapter(cmdstr);
DataSet ds = new DataSet();
da.Fill(ds);
for (int i =0 ; i < ds.Tables[0].Rows.Count; i++)
{
conn.Open();
string insert1 = "INSERT INTO chequeleafdetails(BANKCODE, BRANCHCODE, ACCOUNTTYPE, ACCOUNTSUBTYPE, ACCOUNTNO, ACCOUNTID, CHEQUENO, CHEQUESTATUS, CHEQUESTATUSDATE,OPERATORID, OFFICERID, INSTRCODE, SERIES)VALUES('" + ds.Tables[0].Rows[i][0] + "','" + ds.Tables[0].Rows[i][1] + "','" + ds.Tables[0].Rows[i][2] + "','" + ds.Tables[0].Rows[i][3] + "','" + ds.Tables[0].Rows[i][4] + "','" + ds.Tables[0].Rows[i][5] + "'," + ds.Tables[0].Rows[i][6] + ",'" + ds.Tables[0].Rows[i][7] + "','" + ds.Tables[0].Rows[i][8] + "','" + ds.Tables[0].Rows[i][9] + "','" + ds.Tables[0].Rows[i][10] + "','" + ds.Tables[0].Rows[i][11] + "','" + ds.Tables[0].Rows[i][12] + "')";
MySqlCommand cmd2 = new MySqlCommand(insert1, conn);
string str1 = "select * from chequeleafdetails where ACCOUNTNO='" + ds.Tables[0].Rows[i][4] + "' and BRANCHCODE='0002' AND CHEQUENO=" + ds.Tables[0].Rows[i][6] + "";
MySqlCommand CMD3 = new MySqlCommand(str1, conn);
int COUNT =int.Parse(CMD3.ExecuteScalar().ToString());
if (COUNT > 0)
{
}
else
{
cmd2.ExecuteNonQuery();
}
conn.Close();
}
Label3.Text = "Record Inserted Successfully";
推荐答案
设置cmdstr.CommandTimeout = 0;
或者也为cmd2提供CommandTimeOut。尝试一下。
否则请检查这些类似的帖子
超时已过期。 [ ^ ]
超时过期最超时周期为经过的在先TO-完成操作 [ ^ ]
http://support.microsoft.com/kb/260559 7 [ ^ ]
希望这适合你:)
set cmdstr.CommandTimeout = 0;
or give CommandTimeOut for cmd2 as well. Try it out.
Else check these similar posts
Timeout expired.[^]
timeout-expired-the-timeout-period-elapsed-prior-to-completion-of-the-operation[^]
http://support.microsoft.com/kb/2605597[^]
Hope this works for you :)
这篇关于如何解决此错误超时已过期。操作完成之前经过的超时时间或服务器没有响应。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文