Private Sub FrmRpt1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim rpt As New ReportDocument()
For Each T As CrystalDecisions.CrystalReports.Engine.Table In CrystalReport11.Database.Tables
Dim Log As New CrystalDecisions.Shared.TableLogOnInfo
Log.ConnectionInfo.ServerName = "XXX"
Log.ConnectionInfo.UserID = "XX"
Log.ConnectionInfo.Password = "XXXXXXXX"
Log.ConnectionInfo.DatabaseName = "XXXXXXXXX"
T.ApplyLogOnInfo(Log)
Next
rpt.Load("D:\CrystalReport1.rpt")
Me.CrystalReportViewer1.ReportSource = rpt
Me.CrystalReportViewer1.Refresh()
End Sub