这是我在asp.net下用vb.net写的。调试通过,如果你还需要实现一些统计的图示的话,那么你就必须在把报表先在设计器中做好你想要的是什么炳图,柱图,然后通过dataset来实现。希望对你有点帮助,如果有什么问题在发出来了
Imports System.Drawing
Public Class WebForm5
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
BindReport("Select * from test5")
End Sub
Sub BindReport(ByVal SQL As String)
MyDA.SelectCommand = MyCommand
'已建好的DATASET的文件
Dim myDS As New Dataset2()
'This is our DataSet created at Design Time
MyDA.Fill(myDS, "test5")
'You have to use the same name as that of your Dataset that you created during design time
Dim oRpt As New crp3()
' This is the Crystal Report file created at Design Time
oRpt.SetDataSource(myDS)
' Set the SetDataSource property of the Report to the Dataset
CrystalReportViewer1.ReportSource = oRpt
' Set the Crystal Report Viewer's property to the oRpt Report object that we created
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BindReport("select * from test5 where sz<500")
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BindReport("select * from test5")
End Sub
End Class