大家好的一天,任何人都可以帮助我完成我的项目我已经创建了一个vb.net应用程序,在报告中创建了一个473052记录,我需要在报告加载到这里之前的3-5分钟是我的代码:
---我的职能
Public Function staffbyyear(ByVal dates As String) As DataTable
Dim db = New database
Dim dt As New DataTable
With db
.sqlStr = "SELECT date, attendant, subtotal FROM transactions where year(date)= '" & dates & "' and finish = 1" 'query string
.sqlDa.SelectCommand = .sqlcm(.sqlStr, .connect) 'execute command
.sqlDa.Fill(.sqlDt) 'get results and store in sqldt
.close()
End With
dt = db.sqlDt
Return dt
End Function
- 填写我的报告
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Private rptstr as string
Private Sub fillreportstaffbyyear(ByVal d As String)
Dim cryRpt As New ReportDocument
Dim rptPath = Application.StartupPath.Remove(Application.StartupPath.IndexOf("bin"), Len(Application.StartupPath) - Application.StartupPath.IndexOf("bin"))
cryRpt.Load(rptPath & "reportstaffbyyear.rpt") '
cryRpt.SetDataSource(staffbyyear(cmbyear.Text))
'---modified here
crviewer.crv1.ReportSource = cryRpt
rptstr = vbNullString
End Sub
- 显示报告
Private Sub ButtonX5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX5.Click
Dim strname As String = cmbyear.Text.Trim
fillreportstaffbyyear(strname)
crviewer.Show()
End sub