Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Crystal Report run time error:

$
0
0

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
   Dim ExportOpts As New CrystalDecisions.Shared.ExportOptions
   Dim DiskOpts As New CrystalDecisions.Shared.DiskFileDestinationOptions
  

    gSql = "{CASECLM.Case_NUM}>0 AND {CASECLM.Case_NUM}<1000000"
 
    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      

                                                       

    With crRptVwr  

            .SelectionFormula = gSql 

            .ReportSource = cr                                                                                                        

            .RefreshReport()                                                    

            .Zoom(72%)                                                                      

     End With 
End Sub

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>