• 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


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

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
End With

Set cmd = Nothing
Set par1 = Nothing

Open in new window

1 Solution
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.

Chris BottomleySoftware Quality Lead EngineerCommented:
Line 8 try modifying:

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

holemaniaAuthor Commented:
Thanks there were a number of issues, but got it working now.
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