theNoobProgrammer
theNoobProgrammer

Reputation: 932

Calling a stored procedure using vbscript

I am looking over some code that another programmer made where he calls a stored procedure. Before calling it, he creates an Array with the parameters needed for the stored procedure to query the table. He creates the array like this:

param = Array("@Name", 3, 8, "Tom", _
            "@Age", 3, 8, 28, _
            "@City", 100, 200, "Toronto)

The stored procedure uses @Name, @Age and @City to query the table.

My question is, what are the numbers in between for?

Upvotes: 0

Views: 576

Answers (3)

mafue
mafue

Reputation: 1878

Without comments it's impossible to know for sure or without stepping through the code.

Otherwise, if this is asp.net the best you can do is look at the SqlParameter class and see the properties it has available: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlparameter.aspx

I think you have two strong candidates for ParameterName and Value, but the two numerical values could be a few different things. 3 just happens to be the numerical value for SqlDbType.Char and while 100 has no corresponding SqlDbType, the default for that type is NVarChar.

The next number could be precision. Take a look at the Database table and see if you can match those values to the fields. For example, is City VarChar(200)?

Upvotes: 0

Eduardo Molteni
Eduardo Molteni

Reputation: 39453

My guess is that he is using an array of params, just something like this: https://stackoverflow.com/a/10142254/2385, where I use an array of params to pass to a function who add the params to the ADO command.

Upvotes: 0

Kris Krause
Kris Krause

Reputation: 7326

It looks like:

@Name = parameter name

3 = adInteger

8 = length

"Tom" = value

@Age= parameter name

3 = adInteger

8 = length

28 = value

@City= parameter name

100 = length

200 = adVarChar

"Toronto = value

Here is a list for the other ADO Data Types -

http://www.w3schools.com/ado/ado_datatypes.asp

Upvotes: 2

Related Questions