• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

vbscript - excuting stored procedure error

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
holemania
Asked:
holemania
1 Solution
 
SiddharthRoutCommented:
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
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Line 8 try modifying:

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


Chris
0
 
holemaniaAuthor Commented:
Thanks there were a number of issues, but got it working now.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now