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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...