While I try to open crystal rpt from my vb.net app, I get a dialog box to fill in login info. I fill it in, but I get login failed message even though all the connection info is correct. What could be done to fix it? Thanks.
Private Sub frmLetter_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmLetter.Load
''CR Variables
Dim crReportDocument As Letter
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
'Create an instance of the strongly-typed report object
crReportDocument = New Letter()
Dim ologin as new login()
'Setup the connection information structure to be used
'to log onto the datasource for the report.
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = ologin.server 'physical server name
.DatabaseName = ologin.database
.UserID = ologin.username
.Password = ologin.password
End With
'Get the table information from the report
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
'Loop through all tables in the report and apply the connection
'information for each table.
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
'Set the viewer to the report object to be previewed.
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.Visible = True
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.RefreshReport()
End Sub
Private Sub frmLetter_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles frmLetter.Load
''CR Variables
Dim crReportDocument As Letter
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
'Create an instance of the strongly-typed report object
crReportDocument = New Letter()
Dim ologin as new login()
'Setup the connection information structure to be used
'to log onto the datasource for the report.
crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = ologin.server 'physical server name
.DatabaseName = ologin.database
.UserID = ologin.username
.Password = ologin.password
End With
'Get the table information from the report
crDatabase = crReportDocument.Database
crTables = crDatabase.Tables
'Loop through all tables in the report and apply the connection
'information for each table.
For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next
'Set the viewer to the report object to be previewed.
CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.RefreshReport()
CrystalReportViewer1.Visible = True
CrystalReportViewer1.Zoom(100)
CrystalReportViewer1.DisplayGroupTree = False
CrystalReportViewer1.RefreshReport()
End Sub