Public CrystalCon As CrystalDecisions.Shared.ConnectionInfo = New CrystalDecisions.Shared.ConnectionInfo
'กำหนด Path ใหม่เข้าไป (DatabaseLocation คือ ตัวแปลเก็บชื่อ path ไว้นะ)
CrystalCon.DatabaseName = DatabaseLocation
หน้า Form Report viewer Code (VB.NET)
Dim reportDocument1 As New CrystalDecisions.CrystalReports.Engine.ReportDocument
reportDocument1.Load(Application.StartupPath & "\RPT\RPT.rpt")
Dim tbllog As CrystalDecisions.Shared.TableLogOnInfo
Dim tbCurrent As CrystalDecisions.CrystalReports.Engine.Table
For Each tbCurrent In reportDocument1.Database.Tables
tbllog = tbCurrent.LogOnInfo
tbllog.ConnectionInfo = CrystalCon
tbCurrent.ApplyLogOnInfo(tbllog)
Next tbCurrent