如何在VB上正确使用crystalreport [英] How to properly use crystalreport on VB

查看:77
本文介绍了如何在VB上正确使用crystalreport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以教我或指导水晶报告代码吗?即使只是简单的。我的项目真的需要它。我制作了一个代码,但我不知道它是否正确并且无法正常工作。这是我的代码。



Hi, can anyone teach or guide me on crystal report codes? Even just simple ones. I really need it for my project. I made a code but I don't know if it's correct and it's not working. Here's my code.

Private Sub btnAPrint_Click(sender As Object, e As EventArgs) Handles btnAPrint.Click
        Dim report As New ReportDocument
        report.Load("AttendanceReport.rpt")
        report.RecordSelectionFormula = "{tblAttendance.Date=}" & DTPAttendance.Text
        docprint.CrystalReportViewer1.ReportSource = report
        docprint.CrystalReportViewer1.Refresh()
        docprint.Show()
    End Sub





我尝试了什么:



我尝试制作自己的代码。但我对水晶报告一无所知。



What I have tried:

I tried making my own code. But I don't really know anything about crystal reports.

推荐答案

report.SelectionFormula = "{tblAttendance.Date}=""" & DTPAttendance.Text & """"


首先看下面部分是错误的:

At the first look below part is wrong:
report.RecordSelectionFormula = "{tblAttendance.Date=}" & DTPAttendance.Text





应该是:



It should be:

report.SelectionFormula = "{tblAttendance.Date}=#" & DTPAttendance.Text & "#"





详情请见:

使用选择公式创建报告 [ ^ ]

在代码中手动设置选择公式 [ ^ ]

将记录选择推送到数据库服务器 [ ^ ]

教程 [ ^ ]



检查 CP KB [ ^ ]也是!



For further details, please see:
Creating a Report with a Selection Formula[^]
Setting the Selection Formula Manually in Code[^]
Pushing Down Record Selection to the Database Server[^]
Tutorials[^]

Check CP KB[^] too!


这篇关于如何在VB上正确使用crystalreport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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