2011-09-22 3 views
2

먼저 내가 한 가지만 말하면서, 나는 어떤 종류의보고로도 일한 적이 없다. 나는이 주제와 관련된 모든 질문과 대답을 읽었습니다. 그러나 구체적인 해결책을 찾지 못했습니다.어떻게 크리스탈 또는 rdlc 보고서에서 C#의 비즈니스 개체를 바인딩 할 수 있습니까?

제 문제는 데이터베이스의 뷰에서 행을 표시해야하는 매우 간단한 보고서입니다. 그 행을 갖기 위해 비즈니스 객체 (엔티티)를 만들었습니다. 엔티티가 내 행을 완벽하게 잡고 있습니다. 나는 크리스탈 리포트와 rdlc 리포트도 시도했다. 그러나 결국에는 하나만 선택할 것입니다. 그래서 저는 제 해결책에 대한 수정 보고서를 가지고 있습니다. 내 aspx 양식에서 나는 보고서 뷰어를 찍었습니다. 보고서, 보고서 뷰어 및 정보를 보유하고있는 개체 또는 개체와 같이이 세 가지를 함께 사용하는 방법을 알지 못합니다.

지금 코드가 여기에 크리스탈 리포트의 이름 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> 

파일 뒤에 내 코드가

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; 
    } 
} 

입니다 제발, 제게 해결책을주세요, 필사적으로 해결책이 필요합니다. 모든 스마트 기술 괴짜 들께 미리 감사드립니다.

답변

1

ReportSource 개체를 만들고 보고서에 할당해야합니다 (here).

CrystalReportViewerMRN.ReportSource = myReportSource;

관련 문제