Running stored proc doesn't fully complete
Posted: Tue Dec 09, 2014 10:54 am
Hi,
I have a plugin which puts a button on the debtors maintenance ribbon which simply runs a stored proc - no parameters.
When the button is clicked, the stored procedure doesn't seem to fully complete. When I execute it in a SQL query window it completes fine, taking about 2 to 3 minutes.
I am wondering if there is some kind of built in timeout or row limitation in the ExecuteReader which is stopping the stored proc from running to completion? There is no error displaying and no rows need to be returned to the plugin for processing elsewhere. The stored proc reads some debtor custom fields and populates another table elsewhere and the rows it needs to deal with can be 10,000 to 20,000. The stored proc, when executed from the button seems to handle smaller recordsets OK, but a typical scenario would be much higher.
Maybe if CommandType.StoredProcedure was not specified and it just executes a SQL statement "EXEC usp_MyStoredProc" ? How would I do that - just leave out the CommandType.StoredProcedure line?
Other ideas?
I have a plugin which puts a button on the debtors maintenance ribbon which simply runs a stored proc - no parameters.
- Code: Select all
Private Sub DebtorForm_Toolbar_ToolClick
With JiwaApplication.Manager.Instance.Database
Dim SQL As String = ""
Dim SQLReader As SqlDataReader = Nothing
Dim SQLParam As SqlParameter = Nothing
SQL = "usp_MyStoredProc"
Using SQLCmd As SqlCommand = New SqlCommand(SQL, .SQLConnection, .SQLTransaction)
SQLCmd.CommandType = System.Data.CommandType.StoredProcedure
SQLReader = SQLCmd.ExecuteReader()
SQLReader.Close()
SQLCmd.Dispose()
End Using
End With
End Sub
When the button is clicked, the stored procedure doesn't seem to fully complete. When I execute it in a SQL query window it completes fine, taking about 2 to 3 minutes.
I am wondering if there is some kind of built in timeout or row limitation in the ExecuteReader which is stopping the stored proc from running to completion? There is no error displaying and no rows need to be returned to the plugin for processing elsewhere. The stored proc reads some debtor custom fields and populates another table elsewhere and the rows it needs to deal with can be 10,000 to 20,000. The stored proc, when executed from the button seems to handle smaller recordsets OK, but a typical scenario would be much higher.
Maybe if CommandType.StoredProcedure was not specified and it just executes a SQL statement "EXEC usp_MyStoredProc" ? How would I do that - just leave out the CommandType.StoredProcedure line?
Other ideas?