2013-07-29 58 views
0

我有一個爲用戶運行sql查詢的小型web應用程序,它將結果打印到pdf/csv。對於較大的疑問,我收到此錯誤:將QueryTimeout參數添加到命令字符串

ERROR [57014] [IBM][DB2/AIX64] SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014 

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: IBM.Data.DB2.DB2Exception: ERROR [57014] [IBM][DB2/AIX64] SQL0952N Processing was cancelled due to an interrupt. SQLSTATE=57014 

research後,事實證明,我需要一個QueryTimeout參數添加到我的連接字符串。除了一些簡單的編輯外,我對vb.net沒有太多經驗。我的相關代碼如下所示:

Imports IBM.Data.DB2 
Dim conn As New DB2Connection(ConfigurationManager.AppSettings(ddDatabase.SelectedValue)) 
Dim cmd As New DB2Command(strSQL, conn) 

回答

1

如果我理解你的問題,我想你應該設置的CommandTimeout上的DB2Command不允許建立連接

Imports IBM.Data.DB2 
Dim conn As New DB2Connection(ConfigurationManager.AppSettings(ddDatabase.SelectedValue)) 
Dim cmd As New DB2Command(strSQL, conn) 
cmd.CommandTimeout = 200 

DB2.CommandTimeout

The time (in seconds) to wait for the command to execute. The default is 30 seconds.

最大時間