使用 SQL Server 2008 R2 在 asp.net c# 中创建 Crystal Report

本文关键字:创建 Crystal Report net asp Server SQL 2008 R2 使用 | 更新日期: 2023-09-27 18:34:33

我正在做调度管理系统。在那里,我想要一个水晶报告,它将接受文本框或下拉列表中的日期,根据该日期,我需要将当天的所有数据显示为报告。

我使用的是Visual Studio 2005和SQL Server 2008 R2。我的数据库名称是字母,用于生成报告的表名称是内部的。

此表包含列

ID, 调度号,

调度日期, 发件人名称, 发件人地址, 主题, 字母类型, 字母号, 备注其中主题、字母类型、字母号可能具有空值。

我想在一列中生成带有 dispatchno.dispatchname、发件人名称和发件人地址的报告,主题和备注一起。

在记录选择公式中,我可以选择日期,但只能选择当天的日期。我需要从文本框或下拉列表中选择一个日期,我需要显示当天的报告。我使用公式 {inward.fromname}+","+{inward.fromaddress} 来连接 fromname 和 fromadrress。它工作正常。但是当我使用公式IIF(IsNull({inward.subject}(,",{inward.remarks}和","(加入主题和评论时,我变得空白。此处的主题具有空值。

我在报告中使用代码.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; 
}

}

使用 SQL Server 2008 R2 在 asp.net c# 中创建 Crystal Report

我得到了在组合数据表的两个字段时避免空值的答案。代码是 ,

如果 IsNull({inward.subject}( 则 "NULL" +',' +{inward.remarks}还 {inward.subject} + ', ' + {inward.remarks}

根据从文本框中选择的日期显示水晶报告仍然有问题。我需要像这样显示。从文本框中显示"发货日期 = 值接受"的水晶报告。