How do I get a VBScript to send a parameter value to sql sp

I want the user to enter the month into the input box: Example: Nov

My parameter in sql is named: @Commissionsmonth

I know my sp works if ran within sql.  Any help with this would be greatly appreciated!

returnvalue=MsgBox ("ARE YOU SURE YOU WANT TO UPDATE COMMISSIONS PAID?",36,"CONFIRM UPDATE!!")
If returnvalue=6 Then
Dim cmd
Dim sp
sp = "asp_update_commissions_paid"
Set cmd = CreateObject("ADODB.Command")
With cmd
.ActiveConnection = "Provider=sqloledb;Data Source=myserver;Initial Catalog=mydatabase;Integrated Security=SSPI"
 .CommandType = 4
 .CommandText = sp


sInput = InputBox("Enter Month being Paid")

returnvalue=MsgBox ("Commissions Paid has been updated",36,"CONFIRM UPDATE!!")
 .Execute
End With
Set cmd = Nothing
End If

 

August 21st, 2015 8:56pm

 .CommandText = "exec asp_update_commissions_paid '" & sInput & "'"
Free Windows Admin Tool Kit Click here and download it now
August 29th, 2015 3:41pm

Thank you so much.  This worked like a charm. You are the best. Below is my script for others.

Dim sServer, sConn, oConn, sDatabaseName, sUser, sPassword
sDatabaseName="datbase name"
sServer="server name"
sUser="user name"
sPassword="password"
sConn="provider=sqloledb;data source=" & sServer & ";initial catalog=" & sDatabaseName
Set oConn = CreateObject("ADODB.Connection")
oConn.Open sConn, sUser, sPassword

sInput = InputBox("Enter Month being Paid") 
oConn.Execute "exec asp_update_commissions_paid '" & sInput & "'"

 

WScript.Echo "Executed"
oConn.Close
Set oConn = Nothing

September 1st, 2015 7:48am

Great.  Glad you were able to understand it.  Use that as a good interface method.  Also look closely at SSIS.

Free Windows Admin Tool Kit Click here and download it now
September 1st, 2015 8:05am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics