HELP: I'm using VB.NET 2005 to open Crystal Report at run time.
I am receiving the following errors,
when I try to open Crystal Report at run time.
Crystal Report Windows Form Viewer
Failed to open the connection,
Details: [Database Vendor Code: 12154]
Failed to open the connection.
CrystalReport1 {12C114E9-EC2A-46C3-2D1A78C4BC48].rpt
Details: [Database Vendor Code: 12154
Here is my code:
Sub OpenCrystalReport()
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.CrystalReports.Engine.ReportClass
Imports CrystalDecisions.CrystalReports.EPFPageObjectFactory
Dim gsql as string=nothing
Dim gsRptPath as string = "C:\CrystalReport1.rpt"
Dim cr As New ReportDocument gSql = "{CASECLM.Case_NUM}>0 AND {CASECLM.Case_NUM}<1000000" With crRptVwr
Dim ExportOpts As New CrystalDecisions.Shared.ExportOptions
Dim DiskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions
With cr
.Load(gsRptPath)
.SummaryInfo.ReportTitle = gsReportTitle.ToString
.SummaryInfo.ReportSubject = gsReportSubject
.SummaryInfo.ReportComments = gsReportComment
For Each myTable In .Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = gOrDaSur '"DSN or Server Name"
myLogin.ConnectionInfo.DatabaseName = "" 'Oracle empty string.
myLogin.ConnectionInfo.UserID = gOrUsrId '"Your User ID"
myLogin.ConnectionInfo.Password = gOrPswd '"Your Password"
myTable.ApplyLogOnInfo(myLogin)
myLogin.ReportName = gsRptPath & gsReportName & ".rpt"
Next
End With
.SelectionFormula = gSql
.ReportSource = cr
.RefreshReport()
.Zoom(72%)
End With
End Sub