在水晶报表中显示两个日期的记录 [英] Show records of two dates there in crystal report

查看:82
本文介绍了在水晶报表中显示两个日期的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过以下代码在水晶报表中通过特定的ID显示信息.

代码:

I can show information by specific ID there in crystal report by following code.

Code:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form6
Inherits System.Windows.Forms.Form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim cryRpt As New ReportDocument
'cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")
'CrystalReportViewer1.ReportSource = cryRpt
'CrystalReportViewer1.Refresh()
Dim cryRpt As New ReportDocument
cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue
crParameterDiscreteValue.Value = TextBox1.Text
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("id")
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
cryRpt.RecordSelectionFormula = "{Button1}= " & TextBox1.Text & ""
End Sub


但是我有一个问题.我有一个表,其中有三个字段.日期一,收入一另一项费用.为了显示它,我有一个表单,两个文本框&一个水晶报表查看器.
我的问题是要显示特定日期的记录很容易&我可以通过以前的代码来做到这一点.但根据用户,他想输入开始日期&结束日期以查看记录.那我现在该怎么办?

你能帮我做吗?例如,他需要输入开始日期1-1-2010&结束日期2010年1月30日他想查看一月月份的所有报告,包括2010年1月1日& amp; 30-1-2010.

我需要帮助,请帮助我.


But I got a problem. I have a table where it has three fields. One for date one for income & another for expense. To show it I have a form two text boxes & one crystal report viewer.
My problem is that to show a record of specific date is easy & I can do it by previous code. But according to user he wants to input starting date & end date to see records. So what should I do now?

Can you please help me to do it? For example he needs to input starting date 1-1-2010 & end date 30-1-2010 & he wants to see all reports of January month including 1-1-2010 & 30-1-2010.

I need help please help me.

推荐答案

这是一个非常基本的水晶报表

在设计报表时,请为开始日期和结束日期创建两个参数,并在查询中添加一个between子句.从您的应用程序传递这两个参数值.或者,您可以使用范围参数.

开始之前,请尝试研究Crystal Report.
This is a very basic of crystal report

In time of designing your report create two parameters for starting and end date and add a between clause in your query. Pass those two parameter values from your application. Alternatively you can use a range parameter.

Try some study on crystal report before you start.


这篇关于在水晶报表中显示两个日期的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆