locked
How to define and set value parameters in sql data source ? RRS feed

  • Question

  • User-970506066 posted

    Dear All,

     based on following SQL Script which is join with other table, May  i know how to define  and set value  parameter  ?

    Kindly advise, thank you

    SELECT
    A.INV_TYPE,
    A.INV_ID,
    A.INV_SHORTDESC,
    A.INV_UNIT,
    B.INV_LOCATION,
    B.INV_BIN,
    ISNULL(B.INV_QTY,0) AS INV_QTY
    FROM CIMProRPT01.dbo.OTH_INV_DETAILS A
    LEFT JOIN CIMProRPT01.dbo.OTH_INV_QTY_LOC B
    ON A.INV_ID = B.INV_ID
    WHERE 1=1
    
    AND A.INV_TYPE =@INV_TYPE
    
    AND A.INV_ID = @INV_ID
    
    ORDER BY A.INV_TYPE,A.INV_ID

    Monday, February 24, 2014 2:05 AM

Answers

  • User-1716253493 posted

    You can set value directly, like

    <asp:Parameter DefaultValue="1000" Name="INV_ID" Type="Int32" />

    Or you can get value from control, querystring, session etc like

    <asp:QueryStringParameter DefaultValue="" Name="INV_ID" QueryStringField="id" 
         Type="Int32" />

    Or use code behind

    SqlDataSource1.SelectParameters("INV_ID").DefaultValue = 1000

    To test your query simply type a value for each parameter

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 24, 2014 2:16 AM