本文介绍了操作完成之前已过超时时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助我解决此问题.

超时到期.在操作完成之前超时时间已过或服务器没有响应"

在处理我的查询时遇到了这个错误..我得到了5种查询,所有4个查询都以低于10秒的时间速率给出结果,而最后1个查询以2m 15s的时间速率运行..

我曾尝试在SQLSERVER 2005中更改超时..但是出现了相同的错误.
我还尝试在RegEdit中将"SQlQueryTimeout更改为600",但仍然遇到相同的错误.
我也在连接字符串中尝试过;
''''sConn =数据源=" +服务器+;初始目录=" + db +;连接超时= 600; UID =" + uid +; PWD =" + pwd
并且仍然存在相同的错误.

我将其添加到我的代码中,如下所示,
da.SelectCommand.CommandTimeout = 600

但出现错误:对象引用未设置为对象的实例.

-> If ds.Tables("iExcelRpt").Rows.Count-1
-> EndIf


代码如下所示:

试试

昏暗的SqlDataAdapter
Dim ds As DataSet
sqlq =选择A.FullDesc,Abs(Sum(B.CBalAmt/100))作为USDBalSeoul,"& _
"Abs(Sum(C.CBalAmt/100))为USDBalPusan,"& _
"Abs(Sum(D.CBalAmt))as KRWBalSeoul,"& _
"Abs(Sum(E.CBalAmt))as KRWBalPusan,"和& _
((Abs(Sum(B.CBalAmt/100))+ Abs(Sum(C.CBalAmt/100)))*"& RO.fxChange& "+ Abs(Sum(D.CBalAmt))+ Abs(Sum(E.CBalAmt))as cTOT,& _
"A.SortCode"& _
来自GLSC A"& _
在A.SortCode = B.SortAcc和B.CcyType =" USD"且B.EopDate ="上的内部加入dlyGLACC B"& RM日期和时间"和B.Br ="455"& _
在A.SortCode = C.SortAcc和C.CcyType =" USD"且C.EopDate ="的内部加入dlyGLACC C"& RM日期和时间''和C.Br =''456''"& _
在A.SortCode = D.SortAcc和D.CcyType =" KRW"和D.EopDate ="上的内部加入dlyGLACC D"& RM日期和时间"和D.Br ="455"& _
在A.SortCode = E.SortAcc和E.CcyType =" KRW"和E.EopDate ="上的内部加入dlyGLACC E"& RM日期和时间"和E.Br ="456"& _
其中A.LevelNumber = 2 AND a.bR ="455",而& _
((Left(A.SortCode,1)=" 1"或Left(A.SortCode,1)="2"或Left(A.SortCode,1)="3")& _
按A.SortCode,A.FullDesc分组"和_
按A.SortCode排序"
da =新的SqlDataAdapter(sqlq,conn)
da.SelectCommand.CommandTimeout = 600
ds =新数据集
da.Fill(ds,"iExcelRpt")

将fEx捕获为异常
MsgBox(fEx.Message)
退出子
Endtry

如果ds.Tables("iExcelRpt").Rows.Count< 1然后
MsgBox(未找到具有交易日期的记录"& RM.mDate,MsgBoxStyle.Information,RM.rptName)

ReportMain.Button2.Enabled = False
ReportMain.ListView1.Enabled = True
ReportMain.ListView1.Focus()
退出子

如果结束

请帮帮我! :|
预先感谢.

Please help me resolve this.

"timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"

Got this error processing my query.. I got 5 kinds of query, all of the 4 queries give results at time rate below 10 seconds, while the last 1 query runs at time rate of 2m 15s..

I''ve tried changing timeout in SQLSERVER 2005.. but the same error appeared.
I also tried changing "SQlQueryTimeout to 600" in RegEdit, but still got the same error.
I also tried in my connection string;
''''sConn = "Data Source=" + server + ";Initial Catalog=" + db + ";connect timeout=600;UID=" + uid + ";PWD=" + pwd
and still with same error.

I add this in my code as shown below,
da.SelectCommand.CommandTimeout = 600

but got error: Object reference not set to an instance of an object.
in
->If ds.Tables("iExcelRpt").Rows.Count - 1
->EndIf


Code is Shown below:

Try

Dim da As SqlDataAdapter
Dim ds As DataSet
sqlq = "Select A.FullDesc, Abs(Sum(B.CBalAmt/100)) As USDBalSeoul, " & _
"Abs(Sum(C.CBalAmt/100)) As USDBalPusan, " & _
"Abs(Sum(D.CBalAmt)) As KRWBalSeoul, " & _
"Abs(Sum(E.CBalAmt)) As KRWBalPusan, " & _
"(Abs(Sum(B.CBalAmt/100)) + Abs(Sum(C.CBalAmt/100))) * " & RO.fxChange & " + Abs(Sum(D.CBalAmt)) + Abs(Sum(E.CBalAmt)) As cTOT, " & _
"A.SortCode " & _
"From GLSC A " & _
"Inner Join dlyGLACC B on A.SortCode = B.SortAcc And B.CcyType = ''USD'' And B.EopDate = ''" & RM.mDate & "'' And B.Br=''455'' " & _
"Inner join dlyGLACC C on A.SortCode = C.SortAcc And C.CcyType = ''USD'' And C.EopDate = ''" & RM.mDate & "'' And C.Br=''456'' " & _
"Inner join dlyGLACC D on A.SortCode = D.SortAcc And D.CcyType = ''KRW'' And D.EopDate = ''" & RM.mDate & "'' And D.Br=''455'' " & _
"Inner join dlyGLACC E on A.SortCode = E.SortAcc And E.CcyType = ''KRW'' And E.EopDate = ''" & RM.mDate & "'' And E.Br=''456'' " & _
"where A.LevelNumber = 2 AND a.bR = ''455'' And " & _
"(Left(A.SortCode,1) = ''1'' or Left(A.SortCode,1) = ''2'' or Left(A.SortCode,1) = ''3'') " & _
"Group by A.SortCode, A.FullDesc " & _
"Order by A.SortCode"
da = New SqlDataAdapter(sqlq, conn)
da.SelectCommand.CommandTimeout = 600
ds = New DataSet
da.Fill(ds, "iExcelRpt")

Catch fEx as Exception
MsgBox(fEx.Message)
Exit Sub
Endtry

If ds.Tables("iExcelRpt").Rows.Count < 1 Then
MsgBox("No records found with Transaction Date " & RM.mDate, MsgBoxStyle.Information, RM.rptName)

ReportMain.Button2.Enabled = False
ReportMain.ListView1.Enabled = True
ReportMain.ListView1.Focus()
Exit Sub

End If

Help Me Please! :|
Thanks in advance.

推荐答案

da.SelectCommand.CommandTimeout = 0



这篇关于操作完成之前已过超时时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 15:13