Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在crystal或rdlc报表中绑定c的业务对象?_C#_Asp.net_Crystal Reports_Rdlc - Fatal编程技术网

C# 如何在crystal或rdlc报表中绑定c的业务对象?

C# 如何在crystal或rdlc报表中绑定c的业务对象?,c#,asp.net,crystal-reports,rdlc,C#,Asp.net,Crystal Reports,Rdlc,首先让我告诉你一件事,我还从来没有做过任何形式的报道。我已经阅读了关于这个话题的所有相关问题和答案。但没有找到任何具体的解决办法 我的问题是我有一个非常简单的报告,我必须从数据库的视图中显示一行。为了获得该行,我创建了一个业务对象(实体)。那个实体完全控制住了我的视线。我也试过crystal report和rdlc report。但最后我只会选择一个。所以我的解决方案中有一个水晶报告。在我的aspx表单中,我使用了一个报表查看器。但我不知道如何使这三件事协同工作,即报表、报表查看器和保存信息的对

首先让我告诉你一件事,我还从来没有做过任何形式的报道。我已经阅读了关于这个话题的所有相关问题和答案。但没有找到任何具体的解决办法

我的问题是我有一个非常简单的报告,我必须从数据库的视图中显示一行。为了获得该行,我创建了一个业务对象(实体)。那个实体完全控制住了我的视线。我也试过crystal report和rdlc report。但最后我只会选择一个。所以我的解决方案中有一个水晶报告。在我的aspx表单中,我使用了一个报表查看器。但我不知道如何使这三件事协同工作,即报表、报表查看器和保存信息的对象或实体

现在代码在这里

crystal报告的名称为FormSaleMoneyReceipt.rpt

我的aspx页面是

<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource>
<div id = "SearchPlace">
    <label for ="">Candidate ID:</label><asp:TextBox runat = "server" ID = "txtCandidateId"></asp:TextBox>
    <label for ="">Form SL#:</label><asp:TextBox runat = "server" ID = "txtFormSl"></asp:TextBox>
    <asp:Button runat = "server" ID = "btnShowReport" Text = "Show Report" 
        onclick="btnShowReport_Click" />
</div>
<div id = "ReportViewrHolder">
    <CR:CrystalReportViewer ID="CrystalReportViewerMRN" runat="server" AutoDataBind="true" />
</div>
</form>

请,请给我一个解决方案,我非常需要这个解决方案。提前感谢所有的智能技术极客。

您必须创建一个
ReportSource
对象,并将其分配给您的报告,如前所述

CrystalReportViewerMRN.ReportSource=myReportSource

protected void Page_Load(object sender, EventArgs e)
{
}

protected void btnShowReport_Click(object sender, EventArgs e)
{
    int candidateId = 0;

    string formSl = txtFormSl.Text;
    ViewFormSaleMoneyReceiptEntity formSaleMoneyReceiptEntity = new ViewFormSaleMoneyReceiptEntity();
    if(txtCandidateId.Text != "")
    {
        candidateId = Convert.ToInt32(candidateId);
        formSaleMoneyReceiptEntity = ViewFormSaleMoneyReceipt_DAO.GetMoneyReceiptByID(candidateId);
        //CrystalReportViewerMRN.ReportSource = formSaleMoneyReceiptEntity; 
    }
    if(txtFormSl.Text!="")
    {
        formSaleMoneyReceiptEntity = ViewFormSaleMoneyReceipt_DAO.GetMoneyReceiptByFormSL(formSl);
        //CrystalReportViewerMRN.ReportSource = formSaleMoneyReceiptEntity; 
    }
}