Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim cryRpt As ReportDocument = New ReportDocument
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
Dim crtableLogoninfos As TableLogOnInfos = New TableLogOnInfos
Dim crtableLogoninfo As TableLogOnInfo = New TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo
Dim CrTables As Tables
crConnectionInfo.ServerName = "YOUR SERVERNAME"
crConnectionInfo.DatabaseName = "DATABASE NAME"
crConnectionInfo.UserID = "USERID"
crConnectionInfo.Password = "PASSWORD"
CrTables = cryRpt.Database.Tables
For Each CrTable As CrystalDecisions.CrystalReports.Engine.Table In CrTables
crtableLogoninfo = CrTable.LogOnInfo
crtableLogoninfo.ConnectionInfo = crConnectionInfo
CrTable.ApplyLogOnInfo(crtableLogoninfo)
Next
cryRpt.Refresh
cryRpt.PrintToPrinter(2, true, 1, 2)
End Sub