Print Page | Close Window

Crystal Report in VS2008 doesn't display data on w

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2022
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=15900
Printed Date: 21 Apr 2025 at 6:45pm


Topic: Crystal Report in VS2008 doesn't display data on w
Posted By: jbeteta
Subject: Crystal Report in VS2008 doesn't display data on w
Date Posted: 16 Mar 2012 at 3:24am
Hello,
I have a problem with my crystal reports in Visual Studio 2008.
My file CrystalReportxxx.rpt has an xsd file as dataschema. Database
to connect is Oracle and using stored procedures.
When I try to output it on a web page with this setting:
        oRpt.SetDatabaseLogon("userxxx", "passwordxxx")
Then report shows no data.
When I try to output it on a web page without this setting:
        oRpt.SetDatabaseLogon("userxxx", "passwordxxx")
Then report asks for credentials like logid and password of database.
This is my code:

        Dim dt As DataTable
        FunctionsOP.CreaDataTable("pkg_list.sp_list", True, ospEntry,
dt)
        Dim oRpt As New Reportes.CrystalReportxxx
        oRpt.SetDatabaseLogon("userxxx", "passwordxxx")
        oRpt.SetDataSource(dt)
        CrystalReportViewer1.ReportSource = oRpt
        CrystalReportViewer1.DataBind()
        CrystalReportViewer1.Dispose()

I suppose that when setting:
        oRpt.SetDatabaseLogon("userxxx", "passwordxxx")
and report shows no data, is because credentials are wrong.
My question is: How to bypass this credential input? Is it mandatory
to input userid, password, etc for using a xsd file in my Crystal
Report?
What is strange is when I export that report to PDF, there is no
problem. Data is shown OK and no credential is asked:

     Dim exportOpts As ExportOptions = oRpt.ExportOptions
        oRpt.ExportOptions.ExportFormatType =
ExportFormatType.PortableDocFormat
        oRpt.ExportOptions.ExportDestinationType =
ExportDestinationType.DiskFile
        oRpt.ExportOptions.DestinationOptions = New
DiskFileDestinationOptions
        CType(oRpt.ExportOptions.DestinationOptions,
DiskFileDestinationOptions).DiskFileName = Server.MapPath("../Temp/" +
PDFName)
        oRpt.Export()
        oRpt.Close()
        oRpt.Dispose()




Replies:
Posted By: lockwelle
Date Posted: 21 Mar 2012 at 8:09am
you don't need to logon for CR if you are pushing the data.
 
have your app get the dataset from the stored proc, then set the DataSource (I think it is this...I have a class that does that and hasn't been modified in years) then call the viewer or whatever you need.
 
The DataSource type that I use when I design reports is ADO.Net.  I also, for design purposes write out the data with both the schema and the data, and point/refresh the datasource for the report in the design environment to that file. 
 
Since you are pushing the data, CR doesn't know or care about the database.
 
HTH
 
Sorry it wasn't sooner, I don't usually look at this forum (most of the others but not this one).



Print Page | Close Window