How To Pass Parameter to .rdlc Report or Crystal Report Using Asp.Net

 Pass Parameter to .rdlc Report



How To Pass Parameters  To  .rdlc Reports  Using Asp.Net  C#  .  Sql Query Using  All Field Select.



DEMO


                  HTML CODING



<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
       
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" 
Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <LocalReport ReportPath="Report.rdlc">
                <DataSources>
                  <rsweb:ReportDataSource 
DataSourceId="ObjectDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
 InsertMethod="Insert"
 OldValuesParameterFormatString="original_{0}"
 SelectMethod="GetData" 
TypeName="DatabaseDataSetTableAdapters.billTableAdapter">
            <InsertParameters>
                <asp:Parameter Name="billno" Type="String" />
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="amount" Type="String" />
            </InsertParameters>
         
        </asp:ObjectDataSource>
   
    </div>
    </form>
</body>

</html>





First  - Add New Web Form - Name - Crystal Report 








Next  - Add - Sql Server Database -  Click - Add  









Click -  Yes Button  - Add to App Data Folder









Next - Select Table - Right Click  - Add New Table 









Add - The  Field Name & DataType   billno,name,amount









Next - click - Update - Update Database  -   Refresh Server Explorer











Next - Right Click - bill Table - Click -  Show Table Data 










Next - Enter the Field Values  billno,name,amount









Next - Select  the  Web Form -  Select - ToolBox - Reporting - Select - Report Viewer 









Next - Select  - Solution Explorer - Right Click  - Add -Add New Item - Select Report - Add 










Next - Select -  New - DataSet  From Report.rdlc File










Next - Select - Database  Name - Click -  Next Button 










Next - Select  - DataConnectinString - Click - Next Button










Next - Select  - Table - Required Table Name  -  Click - Finish  Button










Next - Open Window Form - Select  Name , Data Source , Available Datasets  Click - OK Button 












Next - Go To - Report.rdlc  - Select - DataSet1 









Next - Select - Toolbox - Select  Table Tool 









Next  - Right Click the Table  - Add Field Name - billno









Next  - Right Click the Table  - Add Field Name - name










Next  - Right Click the Table  - Add Field Name - amount









                         Display  the  Added  Fields








Next - Select - DataBaseDataSet.xsd -   Right Click  - Fill GetData() - Click - Configure  









Next  - Select  -  All Table Fields  -  Finish Button Click









Next - WebForm - Add - ScriptManager  From - ToolBox










Next - Select  Report Viewer - Right Click  - Choose Report  - Report.rdlc



Automatically  -  Added  the ObjectDataSource











Next - Select  the  WebForm - Right Click - View in Browser - Click










          

Display  the  All DataBase  Field Vaues 











Select - PDF  -  Click   PDF Formate  Bill Generate & Download 









                                      
                                                Pdf Formate Bill 







 

0 comments:

Post a Comment