Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Procedure time out problems

Status
Not open for further replies.

vbajock

Programmer
Jun 8, 2001
1,921
0
0
US
I am attempting to delete large amounts of data (typically 200,000 records) from a large file based on two parameters that identify the record type, using a stored procedure. If I execute the proc directly in the ADP and type in the parameters, it works great. If I do the exact same thing using an ADO procedure, I get a time out error. I have set the various time out parameters to 0 in the ADO code, and I have set the query -wait in SQL Server 2000 /Servername / Properties page to zero. Nothing seems to change this. Could some one tell me what I am missing?

Here is the proc:
Alter PROCEDURE deltblMastSch
@OrderType char(2),
@OrderSubType char(1)
AS
DELETE FROM tblMastSch Where Ordertype = @OrderType and OrderSubtype=@OrderSubtype


Here is the ADO code:


Public Function DelMastSchBlock(ByVal Ordertype As String, ByVal OrderSubtype As String, ByVal modname As String) As Integer

Dim oConn As New ADODB.Connection
Dim oCmd As New ADODB.Command
Dim RetVal As ADODB.Parameter
Dim blkParam As ADODB.Parameter
Dim blkParam2 As ADODB.Parameter
Dim objerror As ADODB.Error
Dim i As Integer

On Error GoTo err_h
Forms!frmMain!txtModule = modname
Forms!frmMain.Repaint

With oCmd

Set RetVal = .CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, , Null)

.Parameters.Append RetVal
Set blkParam = .CreateParameter("@OrderType", adWChar, adParamInput, 2, Ordertype)
.Parameters.Append blkParam
Set blkParam2 = .CreateParameter("@OrderSubType", adWChar, adParamInput, 2, OrderSubtype)
.Parameters.Append blkParam2

.CommandText = "deltblMastSch"
.CommandType = adCmdStoredProc

oConn.Provider = "SQLOLEDB"
oConn.ConnectionString = "Data Source=FS4;Initial Catalog=MasterSchedule;Trusted_Connection=Yes"
oConn.ConnectionTimeout = 0

oConn.CommandTimeout = 0
oConn.Open
.ActiveConnection = oConn



.Execute
GoTo Exit_Delmast

End With




Exit Function

'************
Exit_Delmast:
'************
DelMastSchBlock = oCmd("RETURN_VALUE")
Set oCmd = Nothing
Set RetVal = Nothing
Set blkParam = Nothing
Set blkParam2 = Nothing
Set objerror = Nothing
oConn.Close
Set oConn = Nothing
Exit Function


'******
err_h:
'*******


For Each objerror In oConn.Errors
MsgBox Str$(objerror.Number) + " " + objerror.Description
msgbox error$
stop


Next




End Function
 
ok, I eventually figured this out myself. To any interested party, this is the solution:

oConn.CommandTimeout = 0

should be oCmd.CommandTimeout = 0

The connection objects' timeout setting has no effect on the command timeout
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top