Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

vbscript - excuting stored procedure error

Posted on 2011-05-02
3
Medium Priority
?
261 Views
Last Modified: 2012-05-11
I have a vbscript that I would like to call out a stored procedure and execute.  There's one parameter that will be use.  However, I kept getting the following error.

Arguments are of the wrong type, are out of acceptable range, or are in conflit with one another. At line 8 position 0.

Below is my script.

Dim cmd
Dim sp


sp = "DIMENSION"

Set cmd = CreateObject("ADODB.Command")
Set par1 = CreateObject("ADODB.Parameter")

par1.Direction=adParamInput
par1.name = "@PO"
par1.size = 30
par1.Type = adVarchar
par1.Value = ORDER_ID

With cmd
.ActiveConnection = "Provider=SQLOLEDB;Server=DBSVR1;Database=TESTDB;UID=USER1;pwd=Password1"
	.CommandType = 4
	.CommedText = sp
	.Execute
End With

Set cmd = Nothing
Set par1 = Nothing

Open in new window

0
Comment
Question by:holemania
3 Comments
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 2000 total points
ID: 35510028
That is because you're using constants that VBScript doesn't recognize.

Add this to the top of your code:

Const adParamInput = 1
Const adVarChar = 200

Now try it.

Sid
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 35510222
Line 8 try modifying:

Set par1 = CreateObject("ADODB.Parameter")
to
Set par1 = cmd.parameter


Chris
0
 

Author Comment

by:holemania
ID: 35708554
Thanks there were a number of issues, but got it working now.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
Integration Management Part 2
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
Suggested Courses
Course of the Month13 days, 2 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question