Running SQL Stored Proc through VBA
I have this code below that only runs a Stored Procedure in SQL Server, for some reason it keeps timing out and I dont understand why.
When running the Stored Proc in SQL Server its fine.
Code:
Option Explicit
Dim cnnDW As ADODB.Connection
Dim rsDW As ADODB.Recordset
Dim stProcName As String
Dim strSQLServer As String
Sub BuildUpdateData()
strSQLServer = "Driver={SQL Native Client};" & _
"Server=CISSQL1;" & _
"Database=CORPINFO;" & _
"Trusted_Connection=Yes"
Set cnnDW = New ADODB.Connection
Application.ScreenUpdating = False
cnnDW.Open strSQLServer
'Lkup_Update All Specialty with Lookup Table to help run ShowResults(C1B, C2B & C3B)
Set rsDW = New ADODB.Recordset
stProcName = "EXEC sp_PARA_UpdateLkUp"
rsDW.CursorLocation = adUseClient
rsDW.Open stProcName, cnnDW, adOpenDynamic, adLockOptimistic, adCmdText
Application.ScreenUpdating = False
cnnDW.Close
Set cnnDW = Nothing
Exit Sub
End Sub
Where have I gone wrong?