Results 1 to 3 of 3

Thread: [RESOLVED] -- Stored Procedure?

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member crosbj's Avatar
    Join Date
    Oct 2000
    Location
    Michigan
    Posts
    285

    Resolved [RESOLVED] -- Stored Procedure?

    Using MSSQL 2k vb6/classic ado. I've search everywhere for a simple answer to this question from these forums to google. I have a simple sproc on my server with syntax as follows:
    Code:
    CREATE PROCEDURE [stp_Stop9Stat]
     AS SELECT Val11 FROM tblConveyorB3 WHERE(Id=27)
    GO
    I don't want to create a recordset I just want the return value of field 'Val11' from my select statement. I can execute this in Query Analyzer and get the value for 'Val11'. How can I do this with ado? All I get is the @Return_Value which is 0 of course. I just want the stored procedure to return the value from my Select statement without creating a recordset object. Here is the code that executes the sproc from within vb.
    Code:
        Dim objCmd As New ADODB.Command
        With objCmd
            .CommandText = "stp_Stop9Stat"
            .ActiveConnection = DbSQLConn
            .CommandType = adCmdStoredProc
            .Execute
        End With
    I know this is simple, but I can't seem to retrieve the value unless I build a recordset and set it to the Execute statement of my sproc? Am I looking at this wrong or can't I return a value from a sproc without using a recorset?
    -jon
    Last edited by Hack; Mar 31st, 2006 at 01:23 PM. Reason: Added Green Resolved Checkmark Last edited by crosbj : Today at 01:12 PM. Reason: Resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width