Hi Kyle & Buran,
I managed to add to the Stored Proc as required..
ALTER PROCEDURE [dbo].[Update_Yield]
-- Add the parameters for the stored procedure here
@RowCount integer OUTPUT
AS
//Queries//
return
END
And My Final ADO Code is
Sub ExecuteStoredProcUpdate_Yield()
Dim SQLConn As ADODB.Connection
Dim SQLCommand As ADODB.Command
Dim SourceQuery As String
Dim lngRecordsAffected As Long 'This will be the variable to hold the number of affected records
Set SQLConn = New ADODB.Connection
Set SQLCommand = New ADODB.Command
SQLConn.ConnectionString = ConnString
SourceQuery = "EXECUTE DB_Common..Update_Yield"
On Error GoTo CloseConnection
SQLConn.Open
Dim returnValue As ADODB.Parameter
With SQLCommand
.ActiveConnection = SQLConn
.CommandType = adCmdStoredProc
.CommandText = SourceQuery
'Create an output param for the return value
Set returnValue = .CreateParameter("@RowCount", adInteger, adParamReturnValue)
'Add the output param
.Parameters.Append returnValue
.Execute
End With
If returnValue = 0 Then MsgBox "Something went wrong", vbCritical
On Error GoTo 0
SQLConn.Close
Exit Sub
CloseConnection:
MsgBox "SQL Stored Procedure Did Not Execute Sucessfully!", vbOKOnly, "SQL Error"
SQLConn.Close
End Sub
But still not working..
After the .Execute Method, it jumps to the CloseConnection label..
Bookmarks