ASP.NET(VB) Passing Parameter Value to Crystal Report

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • imtmub
    New Member
    • Nov 2006
    • 112

    ASP.NET(VB) Passing Parameter Value to Crystal Report

    Hi All,
    I have mainpage (POselect.aspx) . language VB
    In that page i have a textbox (txtPOId) and command button(Button1)
    When i press then button its should send the textbox value to Crystal report and open parameter.

    I have crystal report (CrystalReport1 ) that display the matched records what client entered in the textbox from main page.

    Now my crystal report displaying all the records. but i want to display only specific records.

    One more thought
    Can i filter the records from store procedure. Supply the Main page textbox value and get the result in crystal report. can i do this way? Give me example how?
    Here my SP
    ----------------------

    Code:
     ( @poid nvarchar (25) 
    )
    as
     
    SELECT POD.POD_POLineNbr, POI.POI_StatusCode, POI.POI_LineNbrTypeCode, 
    POI.POI_Reference,POI.POI_ItemName, POI.POI_UnitMeasure, POD.POD_RequiredDate, 
    POD.POD_Promisedate, POR.POR_ReceiverDate, POD.POD_RequiredQty, POR.POR_ReceiptQty, 
    POD.POD_POUnitPrice, ( POD.POD_POUnitPrice*POR.POR_ReceiptQty) As Amt FROM POD INNER JOIN POR ON 
    POD.POD_RequiredDate = POR.POR_RequiredDate AND POD.POD_PurchOrderID = POR.POR_PurchOrderID 
    INNER JOIN POI ON POD.POD_POLineNbr = POI.POI_POLineNbr AND 
    POR.POR_POLineNbr = POI.POI_POLineNbr AND POD.POD_PurchOrderID = POI.POI_PurchOrderID 
    WHERE (POD.POD_PurchOrderID like @POID)
  • imtmub
    New Member
    • Nov 2006
    • 112

    #2
    I have found the solution. I m posting for the reference

    Steps to be done at Report file(.rpt file)

    1.Create a Report file(.rpt) and bind it from your database.

    2.Go to Crystal Reports->Field Explorer->Parameter Fields. Right Click and create a new parameter field. There specify the parameter Name(eg. POID), Value Type as Number/String(Depend on ur type) and at Option Check Discrete Values and finally give Ok.

    3. Go to Crystal Reports->Report->Select Expert and select the table field which you want to use as parameter(eg. PurchaseOrderNu mber). Then u can find a dropdown list, select "is equal to" from the dropdown list. From the next dropdown list select the parameter name(eg. ?POID).


    Steps to be done at Web page(.aspx file)

    1.Create a web page and place the controls CrystalReportVi ewer and CrystalReportSo urce from the toolbox.

    2.Above the CrystalReportVi ewer create a textbox(which to input the parameter value Ordernumber) and submit button.

    3. At CrystalReportSo urce select the .rpt file in properties.


    4.Then go to CrystalReportSo urce ->Report->Parameters(Col lection). Click Add button,there u can find Parameter Name combo box. Select your parameter name(POID).

    5.Then check the "Specify Control ID" and in the following combo box select the Text box ID which you have created to input the parameter value.

    At CrystalReportVi ewer change the value of "Enable Parameter Prompt" to False.


    Thats all. When this page is load you just need to input the parameter value(Purchaseo rdernumber) in the textbox. It will report data according to your input value.




    Originally posted by imtmub
    Hi All,
    I have mainpage (POselect.aspx) . language VB
    In that page i have a textbox (txtPOId) and command button(Button1)
    When i press then button its should send the textbox value to Crystal report and open parameter.

    I have crystal report (CrystalReport1 ) that display the matched records what client entered in the textbox from main page.

    Now my crystal report displaying all the records. but i want to display only specific records.

    One more thought
    Can i filter the records from store procedure. Supply the Main page textbox value and get the result in crystal report. can i do this way? Give me example how?
    Here my SP
    ----------------------

    ( @poid nvarchar (25)
    )
    as

    SELECT POD.POD_POLineN br, POI.POI_StatusC ode, POI.POI_LineNbr TypeCode,
    POI.POI_Referen ce,POI.POI_Item Name, POI.POI_UnitMea sure, POD.POD_Require dDate,
    POD.POD_Promise date, POR.POR_Receive rDate, POD.POD_Require dQty, POR.POR_Receipt Qty,
    POD.POD_POUnitP rice, ( POD.POD_POUnitP rice*POR.POR_Re ceiptQty) As Amt FROM POD INNER JOIN POR ON
    POD.POD_Require dDate = POR.POR_Require dDate AND POD.POD_PurchOr derID = POR.POR_PurchOr derID
    INNER JOIN POI ON POD.POD_POLineN br = POI.POI_POLineN br AND
    POR.POR_POLineN br = POI.POI_POLineN br AND POD.POD_PurchOr derID = POI.POI_PurchOr derID
    WHERE (POD.POD_PurchO rderID like @POID)

    Comment

    Working...