Jump to content

Get values from stored procedure


Recommended Posts

Hi,i have a stored procedure in sql, it takes a parameter, and displays some data:

4> CREATE PROCEDURE usp_Employee(@ID nvarchar(50)  )7> AS8> SELECT name, lastname FROM employee WHERE ID = @ID> GO

i am doing something like this in vb script:

Dim id = "1"Set Conn = CreateObject("ADODB.Connection") Conn.Open "xxx"  Set objCommandSec = CreateObject("ADODB.Command") objCommandSec.ActiveConnection = Conn  objCommandSec.CommandType = 4 objCommandSec.CommandText = "usp_Employee"  .Parameters.Append .CreateParameter("@ID", 200, 1, 100, id)  .ExecuteDim namename = objCommandSec . items("name").Value

but i get to this part:name = objCommandSec . items("name").Valueit sends error: "object name is not in the collections".is like the command object never gets the values from the database.how can i get the values from the dabatase?how can i fix this?thanks..

Edited by derok
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...