Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2003
    Posts
    4

    Unanswered: Displaying SPROC returned values in asp

    Hello,
    I have the following SPROC on my SQL 7.0 DB:

    ALTER procedure Stuff
    (
    @tran_dateStart datetime,
    @tran_dateEnd datetime,
    @tran_Count int OUTPUT
    )

    AS

    SELECT txn_amt FROM xfrq WHERE res_code = '000' and i_xf_date BETWEEN @tran_dateStart AND @tran_dateEnd

    SELECT @tran_Count = COUNT(txn_amt) FROM xfrq WHERE res_code = '000' and i_xf_date BETWEEN @tran_dateStart AND @tran_dateEnd

    GO


    I would like to display the values for @tran_Count in an asp page, as well as all the records pulled from the db by the SPROC. I have the following asp page:

    Dim oConn
    Dim oCmd
    Dim objRS
    Dim StartDate
    Dim EndDate
    Dim N
    Dim R
    Dim RowColor
    Dim Count

    Set oCmd = Server.CreateObject("ADODB.Command")
    Set objRS = Server.CreateObject("ADODB.Command")

    StartDate = Request.Form("From")
    EndDate = Request.Form("To")

    Set oCmd.ActiveConnection = oConn

    oCmd.CommandText = "Stuff"
    oCmd.CommandType = adCmdStoredProc
    oCmd.Parameters.Append oCmd.CreateParameter("@tran_dateStart", adDBTimeStamp, adParamInput, 22)
    oCmd.Parameters.Append oCmd.CreateParameter("@tran_dateEnd", adDBTimeStamp, adParamInput, 22)

    oCmd.Parameters.Append oCmd.CreateParameter("@tran_Count", adInteger, adParamOutput)

    oCmd.Parameters("@tran_dateStart") = StartDate
    oCmd.Parameters("@tran_dateEnd") = EndDate

    Set objRS = oCmd.Execute

    Count = oCmd.Parameters("@tran_Count")

    <Body>
    <%= Count%>
    </Body>

    Somehow i don't get the figure for the count when i pass parameters to this page. Anyone have any suggestions? Thanks
    Last edited by sisi; 12-04-03 at 12:34.

Posting Permissions

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