![](/img/trans.png)
[英]Deploying an Web Application built using Asp.Net,C# and Sql Server 2008 R2
[英]Creating Crystal Report in asp.net c# with SQL Server 2008 R2
我正在做調度管理系統。 我想要一個水晶報表,該報表將接受文本框或下拉列表中的日期,並且根據該日期,我需要將當天的所有數據顯示為報表。
我正在使用Visual Studio 2005和SQL Server 2008 R2。 我的數據庫名稱是字母,用於生成報告的表名稱是內部的。
該表具有列
id,dispatchno,dispatchdate,fromname,fromaddress,主題,字母類型,letterno,備注,其中主題,字母類型,letterno可能具有空值。
我想生成帶有dispatchno.dispatchname,fromname和from address的報告,同時在主題和備注列中。
在記錄選擇公式中,我可以選擇日期,但只能在該天。 我需要從文本框或下拉列表中選擇一個日期,然后顯示該日的報告。 我使用公式{inward.fromname} +“,” + {inward.fromaddress}來連接fromname和fromadrress。 工作正常。 但是,當我使用公式IIF(IsNull({inward.subject}),“”,{inward.remarks}&“,”)加入主題和評論時,我變得空白了。 這里的主題具有空值。
我在reports.aspx.cs頁面中使用類似的代碼。
使用CrystalDecisions.CrystalReports.Engine;
使用System.Data.SqlClient;
公共局部類_Default:System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(Server.MapPath("CrystalReport.rpt"));
CrystalReportViewer1.ReportSource = cryRpt;
}
}
我得到了在合並數據表的兩個字段時避免空值的答案。 代碼是,
如果為IsNull({inward.subject}),則為“ NULL” +','+ {inward.remarks},否則為{inward.subject} +','+ {inward.remarks}
根據從文本框中選擇的日期顯示水晶報表仍然存在問題。 我需要這樣顯示。 顯示水晶報表,其中派發日期=值從文本框中接受。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.