How to pass parameter to store procedure from asp

  • Hi

    I wounder some could help me. I am bit new to store procedure and asp.

    I have store procedure like below;

    ALTER PROCEDURE [dbo].[getStaff]

    @uId int,

    @sDate date,

    @eDate date

    AS

    BEGIN

    SET NOCOUNT ON;

    -- Insert statements for procedure here

    SELECT tblXYZ.uId, tblXYZ.aDate, tblXYZ.note

    FROM tblXYZ

    WHERE tblXYZ.uId = @uId

    AND tblXYZ.aDate >= @sDate

    AND tblXYZ.aDate <= @Date

    END

    When I run it, I am getting following error.

    Type mismatch.

    Please can someone help me.

    many thanks

    ASP Code

    <%

    myuId = 1

    mySDate = "'07/26/2010'"

    myEDate = "'07/31/2010'"

    objConn.Open CONN_STRING

    ' Create recordset and set the page size / Open RS

    Set RS = Server.CreateObject("ADODB.Recordset")

    RS.Open "Exec getStaffAppointment " & myStaffId, myStartDateUS, myEndDateUS,

    objConn

    %>

  • RS.Open "Exec getStaffAppointment " & myStaffId, myStartDateUS, myEndDateUS,objConn

    Modify this line as below.

    RS.Open "Exec getStaffAppointment " & myStaffId & "," & myStartDateUS & "," & myEndDateUS,objConn

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply