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

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...