Can someone help me with this?
I'm trying to run a stored procedure from excel so I can pass the results to the spreadsheet. But the problem I'm having is the procedure requires a @beginDate and a @endDate.
My questions is how can I ask send this values from the excel when I run the procedure?
thanks a bunch!
here is the code I have in excel:
Public Sub Daily_results()
Dim cnn As Object
Dim CRecordset3 As Object
' Create a connection object
Set cnn = CreateObject("ADODB.Connection")
' Connect to the database
cnn.Provider = "SQLOLEDB"
cnn.Open "Server=Vaio;Database=Product;User Id=admin;Password=password"
If cnn.State <> 1 Then
MsgBox "Could not connect to the database"
' Open recordset BeginNextRecordset
Set CRecordset3 = CreateObject("ADODB.Recordset")
CRecordset3.Open "EXEC spGetDailyCC", cnn, adOpenDynamic, adLockPessimistic
Set cnn = Nothing