我创建水晶报告,要求用户输入...我用户参数字段询问开始日期和结束日期以获取报告...
一切顺利,直到用户提交他们的开始和结束日期......
水晶报告不断询问数据库的密码,除非我把它写在代码中......这里是我的代码
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
If DropDownList1.SelectedValue = "Jam Masuk" Then
Dim reportdocument As New ReportDocument()
reportdocument.Load("D:\MIS Project\Master Project MIS\BSTM\Security\ReportTamuMasuk.rpt")
reportdocument.SetDatabaseLogon("sa", "P@ssw0rd")
reportdocument.SetParameterValue("Akhir Jam Masuk", Label2.Text)
CrystalReportViewer1.ReportSource = reportdocument
CrystalReportViewer1.Visible = True
ElseIf DropDownList1.SelectedValue = "Jam Keluar" Then
Dim reportdocument As New ReportDocument()
reportdocument.Load(Server.MapPath("ReportTamuKeluar.rpt"))
reportdocument.SetDatabaseLogon("sa", "P@ssw0rd")
reportdocument.SetParameterValue("Akhir Jam Keluar", Label2.Text)
CrystalReportViewer1.ReportSource = reportdocument
CrystalReportViewer1.Visible = True
Else
CrystalReportViewer1.Visible = False
End If
End Sub