crystal reports and database login
i am developing an application and trying to have my application send the database logon so the report does not prompt me. im using visual studio 2005 and crystal reports devloper XI SP 2 this is my code
Private Sub configurecrystalreports()
Dim myConnectionInfo As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo()
myConnectionInfo.ServerName = "xxx"
myConnectionInfo.DatabaseName = "yyy"
myConnectionInfo.UserID = "zzzz"
myConnectionInfo.Password = "wwww"
Dim reportpath As String = Application.StartupPath & "\" & "statement.rpt"
crv1.ReportSource = reportpath
Dim myTableLogOnInfos As CrystalDecisions.Shared.TableLogOnInfos = crv1.LogOnInfo
For Each myTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo In myTableLogOnInfos
myTableLogOnInfo.ConnectionInfo = myConnectionInfo
Next
End Sub
now i get a load report failed, then prompted for the database logon, then another load report failed and finally the report will display in my viewer. The report does contain a subreport, as well the report main and subreport each use a view to get data, all in the same database.
|