0

ストアド プロシージャを実行しようとしましたが、クリックしてアプリから実行するたびに、次のエラーでタイムアウトします。

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

以下のルーチンで何か変更する必要がある場合、何かアイデアはありますか?

Private Sub Reset()
    Dim connectionString As String = ConfigurationManager.ConnectionStrings("constring").ConnectionString
    Dim storedProcName As String = "insertnewSP"
    Dim conn As SqlConnection = New SqlConnection(connectionString)
    conn.Open()
    Dim command As SqlCommand = New SqlCommand(storedProcName, conn)
    command.CommandType = CommandType.StoredProcedure
    command.ExecuteNonQuery()
    command.Dispose()
    conn.Close()
    conn.Dispose()
End Sub
Protected Sub Refresh_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Refresh.Click
    ' Clean up text to return the Gridview to it's default state
    Reset()
    strsearch.Text = ""
    SearchString = ""
    gridView1.DataBind()
End Sub

どうもありがとう

4

1 に答える 1

0

呼び出しが完了する前に CommandTimeout が期限切れになる可能性があります。これを試してください。

Private Sub Reset()
    Dim connectionString As String = ConfigurationManager.ConnectionStrings("constring").ConnectionString
    Dim storedProcName As String = "insertnewSP"
    Dim conn As SqlConnection = New SqlConnection(connectionString)
    conn.Open()
    Dim command As SqlCommand = New SqlCommand(storedProcName, conn)
    command.CommandType = CommandType.StoredProcedure
    command.CommandTimeout = 180
    command.ExecuteNonQuery()
    command.Dispose()
    conn.Close()
    conn.Dispose()
End Sub

Protected Sub Refresh_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Refresh.Click
    ' Clean up text to return the Gridview to it's default state
    Reset()
    strsearch.Text = ""
    SearchString = ""
    gridView1.DataBind()
End Sub
于 2012-08-22T15:46:48.870 に答える