wykzimme
asked on
Crystal Reports Runtime/database login information
I have a windows form with a CrystalReportViewer, button, and OpenFileDialog.
I would like the user to be able to select the report to view but I want the application to supply the username/password. I really don't want the Database Login dialog box to appear. Is this possible?
I tried:
Private Sub btnOpenReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenReport.Click
OpenFileDialog1.Filter = "Crystal Reports|*.RPT"
If OpenFileDialog1.ShowDialog () = DialogResult.OK Then
CrystalReportViewer1.Repor tSource = OpenFileDialog1.FileName
End If
End Sub
Private Sub CrystalReportViewer1_Repor tRefresh(B yVal source As Object, ByVal e As CrystalDecisions.Windows.F orms.Viewe rEventArgs ) Handles CrystalReportViewer1.Repor tRefresh
Dim logOnInfo As New TableLogOnInfo
logOnInfo.ConnectionInfo.S erverName = "servername"
logOnInfo.ConnectionInfo.D atabaseNam e = ""
logOnInfo.ConnectionInfo.U serID = "username"
logOnInfo.ConnectionInfo.P assword = "password"
CrystalReportViewer1.LogOn Info.Add(l ogOnInfo)
End Sub
I would like the user to be able to select the report to view but I want the application to supply the username/password. I really don't want the Database Login dialog box to appear. Is this possible?
I tried:
Private Sub btnOpenReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpenReport.Click
OpenFileDialog1.Filter = "Crystal Reports|*.RPT"
If OpenFileDialog1.ShowDialog
CrystalReportViewer1.Repor
End If
End Sub
Private Sub CrystalReportViewer1_Repor
Dim logOnInfo As New TableLogOnInfo
logOnInfo.ConnectionInfo.S
logOnInfo.ConnectionInfo.D
logOnInfo.ConnectionInfo.U
logOnInfo.ConnectionInfo.P
CrystalReportViewer1.LogOn
End Sub
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Instead of
CrystalReportViewer1.LogOn
you can use:
vnt=reportdocumentobject.D
for i=0 to vnt-1
reportdocumentobject.Datab
next
and maybe you need:
logoninfo=reportdocumentob
before:
logOnInfo.ConnectionInfo.S
George