ReportDocument.SetDataSource(DataTable dataTable) OutOfMemoryException

When a customer attempts to display a certain report with a calendar year of data, they get the OutOfMemoryException.  Apparently they can successfully display any other report before or after.  This is .NET 2.0, Crystal Reports 2008 on a desktop client querying a database server.
Exception: Exception of type 'System.OutOfMemoryException' was thrown. (Type: System.OutOfMemoryException; Source: System.Data)
STACK TRACE (Top Level):
   at System.Data.Common.Int32Storage.SetCapacity(Int32 capacity)
   at System.Data.RecordManager.set_RecordCapacity(Int32 value)
   at System.Data.RecordManager.GrowRecordCapacity()
   at System.Data.RecordManager.NewRecordBase()
   at System.Data.RecordManager.CopyRecord(DataTable src, Int32 record, Int32 copy)
   at System.Data.DataTable.CopyRow(DataTable table, DataRow row)
   at System.Data.DataTable.Copy()
   at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
Can any configuration be set to provide more memory?  Is there a way to tell in advance if a dataset or datatable is too large?

Doh... Sorry should have noticed that you are using a DS
Yes, in CR 9 it was lighter, after CR 10 they rewrote/updated the DB drivers as well as other new features so CR consumes more memory space.
DS's are good for about 5K rows, depends on the amount of data in the row of course, anything more and you will always get an out of memory error. Due to limitations in the way Windows handles DS's, now one can access the DS directly so when you use it CR needs to copy the DS it our memory space thus doubling the amount of memory required.
If you are going to allow them to use large data sets then either create another report that hits the DB directly or convert the existing report using RAS using the Replace_Connection method ( search here for sample code ) and set location to the DB using OLE dB Provider.
Thanks
Don

Similar Messages

  • Error on reportdocument.SetDataSource

    Hello. I am working in VS 2010 environment. I am trying to open a report based off of data set. But looks like I am doing something wrong, it's throwing an exception with 'Invalid report file path'. Can you tell me what I need to do load from a dataset correctly? I am crystal reports for VS2010. Thanks.
    Here's my code:
        Private Sub loadCrystalReport() Handles CrystalReportViewer1.Load
            Dim dsData As New Data.DataSet
            Dim sqlcmm As SqlClient.SqlCommand
            Dim daAdapter As New SqlClient.SqlDataAdapter
            Dim cnn As New SqlClient.SqlConnection
            cnn.ConnectionString = " server=bbsql5;" & _
                "uid=masif;password=testpass;database=casemang"
            cnn.Open()
            If cnn.State = ConnectionState.Open Then
                sqlcmm = New SqlClient.SqlCommand("select * from dailylog", cnn)
                daAdapter.SelectCommand = sqlcmm
                daAdapter.Fill(dsData, "DailyLog")
                If dsData.Tables(0).Rows.Count > 0 Then
                    reptDoc.SetDataSource(dsData)
                    CrystalReportViewer1.ReportSource = reptDoc
                End If
            End If
        End Sub

    Not sure why it's not giving me the results from the select query instead of the whole report then. Here's my code.
    reptDoc is the the document. I am trying to load the report DailyLog.rpt with the data set from my query . But right now it loads everything.
        Private Sub loadCrystalReport() Handles CrystalReportViewer1.Load
            Dim dsData As New Data.DataSet
            Dim sqlcmm As SqlClient.SqlCommand
            Dim daAdapter As New SqlClient.SqlDataAdapter
            Dim cnn As New SqlClient.SqlConnection
            cnn.ConnectionString = " server=bbsql5;" & _
                "uid=masif;password=testpass;database=casemang"
            cnn.Open()
            If cnn.State = ConnectionState.Open Then
                sqlcmm = New SqlClient.SqlCommand("select * from dailylog where rundate >='8/18/2011'", cnn)
                daAdapter.SelectCommand = sqlcmm
                daAdapter.Fill(dsData)
                If dsData.Tables(0).Rows.Count > 0 Then
                    reptDoc.Load("l:\reports\ecase\dailylog.rpt")
                    reptDoc.SetDataSource(dsData)
                     CrystalReportViewer1.ReportSource = reptDoc
                    CrystalReportViewer1.RefreshReport()
                End If
                sqlcmm.Dispose()
            End If
        End Sub

  • CrystalDecisions.CrystalReports.Engine.InternalException Error

    Post Author: crash75k
    CA Forum: .NET
    I am getting the following error when generating and printing a crystal report from my .net project.  It's rather intermitant, that is i know the data isn't the problem as have re-run a record which caused the error and it printed successfully.  Little bit confused as to actually what is causing the problem?  One thing i did try is moving to a different printer which helped, that is the problem happens less frequently but still occurs. Any ideas Ta  CrystalDecisions.CrystalReports.Engine.InternalException: Error in File F:\DOCUME1\ADMINI1.RIM\LOCALS1\Temp\Omgeo Import Print {7AE4245E-AC71-47F2-BEDB-C76014B48B83}.rpt:The request could not be submitted for background processing. ---> System.Runtime.InteropServices.COMException (0x800002AD): Error in File F:\DOCUME1\ADMINI1.RIM\LOCALS1\Temp\Omgeo Import Print {7AE4245E-AC71-47F2-BEDB-C76014B48B83}.rpt:The request could not be submitted for background processing.   at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.ReplaceConnection(Object oldConnection, Object newConnection, Object parameterFields, Object crDBOptionUseDefault)   at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)   --- End of inner exception stack trace ---   at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)   at OmgeoImporter.CrystalComponent.setDataSetTable(DataTable dsp)   at OmgeoImporter.Importer.printCrystal(DataSet txtds)

    Post Author: MJ@BOBJ
    CA Forum: .NET
    Intermittent issues can be very difficult to troubleshoot and solve.  This particular error typically occurs when trying to process data (not necessarily a particular row of data), but it could be related to other things (as you noticed when changing printer drivers).  I would make sure you have the latest patch for the version of CR you are using as there have been fixes done for this error.
    Otherwise, I recommend working with the BOBJ support team to help troubleshoot the issue as there are a lot of things that can be investigated to find the root of the issue.

  • AccessViolationException after upgrade to 2008

    I have just now upgraded from the crystal reports basic version that comes with visual studio 2008 to the full Crystal Reports 2008. On opening a project it came up with the upgrade adviser thing and I ran it through seemed to work and compiled properly on running the reports unfortunately I am getting an AccessViolationException.
    CrystalRepSource.Report.FileName = report2;
                    //CrystalRepSource.ReportDocument.SetDatabaseLogon(Application["user"].ToString(), Application["pass"].ToString(),
                    //    Application["server"].ToString(), Application["db"].ToString(), true);
                    //section fills the datasource sets the report title
                    FillStudentRegistersDataTable(studentDataTable, reportSource
                                                    , pfItem1, dcItem1
                                                    , pfItem2, dcItem2
                                                    , pfItem3, dcItem3
                                                    , pfItem4, dcItem4
                                                    , pfItem5, dcItem5
                                                    , pfItem6, dcItem6
                                                    , pfItem7, dcItem7
                                                    , pfItem8, dcItem8
                                                    , pfItem9, dcItem9
                                                    , pfItem10, dcItem10, paramFields);
                    //tidy up bind dataset refresh report...
                    CrystalRepSource.ReportDocument.SetDataSource((DataTable) studentDataTable);
                    CrystalRepSource.DataBind();
                    CrystalViewer.ReportSource = CrystalRepSource;
                    CrystalViewer.DataBind();
    The above is a snippet of the code this is a push report so it first fills a student registers data table. The error comes up on th eline underneath CrystalRepSource.ReportDocument.SetDataSource((DataTable) studentDataTabel).
    I thought it might be push reports so I tried another this failed on trying to set logon info:
    TableLogOnInfo logOnInfo = new TableLogOnInfo();
    logOnInfo = CrystalRepSource.ReportDocument.Database.Tables[0].LogOnInfo;
    Any ideas what the problem is as the error is a bit generic suggests possible memory corruption but that is definately not it. The reports were definately working pre upgrade and I do have a backup but would like to resolve this ASAP as I want to use some of the powerful new features.
    p.s. this has service pack 0 installed

    Forgot here is the stack trace:
    at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.get_ProductLocaleID()
       at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.get_ProductLocaleID()
       at CrystalDecisions.ReportSource.CachedObjectReportSource.GetReport(RequestContext context, Boolean bAddToCacheWhenCreated)
       at CrystalDecisions.ReportSource.CachedObjectReportSource.InternalGetReport(RequestContext context, Boolean bAddToCacheWhenCreated)
       at CrystalDecisions.Web.CrystalReportSource.get_ReportDocument()
       at RegisterReportViewer.ReportParameter(String report, String reportSource) in c:\Visual Studio 2008\WebSites\MIU_web\RegisterReports\RegisterReportViewer.aspx.cs:line 295
       at RegisterReportViewer.OnPreRender(EventArgs e) in c:\Visual Studio 2008\WebSites\MIU_web\RegisterReports\RegisterReportViewer.aspx.cs:line 16
       at System.Web.UI.Control.PreRenderRecursiveInternal()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  • Report.SetDataSource throws exception upgrading from VS2005 to Xtal 2008 VA

    <p>
    Using Visual Studio 2005 with Crystal 2008 Visual Advantage on Vista w/ SP1. Visual Studio has all service packs applied as well.
    </p><p>
    I am trying to evaluate the Crystal 2008 Visual Advantage product.
    </p><p>
    Here's the use case: I get an IEnumerable of a certain object at run time, then pass this list of objects to SetDataSource(IEnumerable).  <b>This code ran fine under the version of crystal included with VS2005, but after installing the product and running the Crystal 2008 VA conversion wizard on this project, SetDataSource now crashes and burns</b> with the following:
    </p><p>
    System.Reflection.TargetParameterCountException  {"Parameter Count Mismatch"}
    </p><p>
    The exception is clearly in the Crystal runtime, as the stack trace reveals (see below).  I should also mention that the database verifies, and that I have been able to relocate the database with the databse locator. No luck. Clean and rebuild, No luck. Anybody got any suggestions?
    </p><p>
    Stack Trace:
    </p><p>
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
    </p><p>
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) </p><p>
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture) </p><p>
       at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.PopulateTableFromObject(Object obj, Boolean flattenCurrentObject, Int32 currentLevel, Int32 maximumLevels, String columnNamePrefix, DataTable table, ArrayList rowset) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.PopulateTableFromObjectCollection(IEnumerable collection, DataTable table) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.BuildTableFromEnumerable(IEnumerable collection, Type dataClassType, String tableName) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.EnumerableToDataSet(IEnumerable collection)
       at CrystalDecisions.CrystalReports.Engine.Table.WrapAndCacheDotNetObject(Object val, Type type, ISCRAdoNetDataSet& crAdoNetDataSet) </p><p>
       at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type) </p><p>
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(IEnumerable enumerable)
    </p><p>

    I have compiled and run these tutorials with no problems.
    <br>
    I must reiterate that I don't see how these tutorials could possibly be pertinent to the problem.
    <br>
    I can set my object collection to be a datasource for other .NET data aware controls such as datagrids and so forth, and to Crystal Reports .rpts compiled with the VS2005 and VS2008 supplied product. I <b><i>cannot</b></i> set my object collection to be a datasource for the stand-alone VA product.
    <br>
    Your XII runtime is crashing with an "invalid number of parameters" exception.  This is a serious programming error, and it cannot be caused by my code -- <b><i>my</b></i> code cannot tell <b><i>your</b></i> runtime how many parms to call a .NET method with.

  • VS2008 Linq To SQL Dataset SetDatasource

    Here is the problem and I have found no helpful solution. I am using LinqToSQL to pull the data into a dataset. No problems there. The problem comes when assigning that dataset as the datasource for a Crystal Report. When I run the report it says
    System.NotSupportedException was unhandled
      Message="DataSet does not support System.Nullable<>."
      Source="System.Data"
      StackTrace:
           at System.Data.DataColumn..ctor(String columnName, Type dataType, String expr, MappingType type)
           at System.Data.DataColumn..ctor(String columnName, Type dataType)
           at System.Data.DataColumnCollection.Add(String columnName, Type type)
           at CrystalDecisions.CrystalReports.Engine.Table.BuildTableFromEnumerable(IEnumerable collection, Type dataClassType, String tableName)
           at CrystalDecisions.CrystalReports.Engine.Table.EnumerableToDataSet(IEnumerable collection)
           at CrystalDecisions.CrystalReports.Engine.Table.WrapAndCacheDotNetObject(Object val, Type type, IntPtr& pUnkDataSet, IntPtr& pDotNetDelegate)
           at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
           at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(IEnumerable enumerable)
           at Pack_Win.frmReports.crystalReportViewer1_Load(Object sender, EventArgs e) in C:\VersioningVS2008\Pack-Win\Pack-Win\Pack-Win\frmReports.cs:line 32
           at System.Windows.Forms.UserControl.OnLoad(EventArgs e)
           at CrystalDecisions.Windows.Forms.CrystalReportViewer.OnCreateControl()
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
           at System.Windows.Forms.Control.CreateControl()
           at System.Windows.Forms.Control.WmShowWindow(Message& m)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      InnerException:
    I have seen references to defaulting the nullables but can't find sample code. Can anyone help with this?

    I have the dataset populated using the code below and was able to create a working report.
    DataSet fds = new DataSet();
                ReportDocument rd = new ReportDocument();
                if (currfunc == "CustList")
                    rd.Load(@".\Reports\CustList.rpt");
                    PackWinDataSet.PACK_CUSTOMERDataTable repdt = new PackWinDataSet.PACK_CUSTOMERDataTable();
                    PackWinDataSetTableAdapters.PACK_CUSTOMERTableAdapter repdat = new Pack_Win._Pack_WinDataSetTableAdapters.PACK_CUSTOMERTableAdapter();
                    repdat.Fill(repdt);
                    fds.Tables.Add(repdt);
                    rd.SetDataSource(fds);

  • SetDataSource causes code reentrance (bug)

    Post Author: willi
    CA Forum: .NET
    Using CR.Net 1.1 SP2 (VS 2003 SP1), WinXP Prof/SP2Problem:Calling the SetDataSource method of a ReportDocument object causes code reentrance, probably due to processing the message queue. This can cause unexpected problems. The callstack in the following example shows that a Timer's Tick event occurs while calling the SetDataSource method:CSSReports.Form1.Timer1_TickSystem.Windows.Forms.Timer.OnTick   System.Windows.Forms.Timer.DebuggableCallback   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load   CrystalDecisions.CrystalReports.Engine.ReportClass.Load   CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource   This must not happen! Other events could occur, too. Is there a hotfix for this problem? This is a serious issue because while loading one report I was able to select a MenuItem and open a 2nd report before loading the 1st report finished (not a multithreaded application). This behavior can just as many problems as explicitly calling Application.Doevents. In short: SetDataSource must not process any messages in the mesage queue.

    It looks like the error only occurred when I used JUnit to test it - which was probably due to something I did.  When I managed to get the code working, the problem was that the newly added table got referenced by the next itteration. I solved it by using a HashMap.
    Map<String, ResultSet> results = new HashMap<String, ResultSet>();
    Tables tables = reportClientDoc.getDatabaseController().getDatabase().getTables();
    for (int i = 0; i < tables.size(); i++) {
        String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(i).getAlias();
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection("jdbc:odbc:CSV_DSN");
        Statement stmt = con.createStatement();
        String query = "select * from " + tables.getTable(i).getName();
        ResultSet rs = stmt.executeQuery(query);
        results.put(tableAlias, rs);
    final Enumeration<String> aliasEnumeration = Collections.enumeration(results.keySet());
    while (aliasEnumeration.hasMoreElements()) {
        String oldAlias = aliasEnumeration.nextElement();
        ResultSet rs = results.get(oldAlias);
        reportClientDoc.getDatabaseController().setDataSource(rs, oldAlias, oldAlias + "_rs");

  • Problem with SetDataSource and SubReports

    Post Author: soxi
    CA Forum: Data Connectivity and SQL
    Hello,
    I have an application wich displays report with a dropdowlist.When I display a report with  subreports, this works once but after I have an error.
    I fill a dataset with several table.One table for the main report et two for the two subreports.
    da = new OracleDataAdapter("request1", cn);da.Fill(ds, "tableMain");da.SelectCommand.CommandText = "request2";da.Fill(ds, "tableSubReport1");da.SelectCommand.CommandText = "request3";da.Fill(ds, "tableSubReport2");cn.Close();
    After I bound my dataset with my report et subreports:
    1 for (int i = 0; i < ds.Tables.Count; i++)2 {3   if (i == 0)4     this.CRSource.ReportDocument.SetDataSource(ds.Tables&#91;i&#93;);5  else 6   {7           this.CRSource.ReportDocument.Subreports&#91;i - 1&#93;.SetDataSource (ds.Tables&#91;i&#93;);8   }this.CRSource.EnableCaching = true;this.CRViewer.ReportSource = this.CRSource;
    Error Message:My error message throws at the line 7:"System.Runtime.InteropServices.COMException: Le canal de communication n'a pas été créé.",(It is a french error, In english I think it was:"The channel of communication has not been established").
    When I enclose this line 7 with a "try" and a "catch" empty, a page come back:This page asks me this information:Server name,Database name, user name and password.
    Ask:I don't understand this error.I have search in all forums.Have you an idea of this problem?

    Thanks i got the audio problem fixed.
    When I open up final cut it says some of the media has been disconnected but it then says I can't reconnect it or something like that, I don't know if that effects the transitions. I split up a lot of footage and rearranged it and for one of the places where it flashes a clip it shows one of the pieces of footage that I had deleted because it had a glitch and the other places I noticed it it had random clips from throughout the project, like a flash of an interview that happens way later in the film. So it is random clips that are in the film and even clips that I deleted.

  • SubreportClientDocument.DatabaseController.SetDataSource problem

    This is a Windows application that uses RAS.
    Here is a code snippet:
    Dim rasDataset As ISCRDataSet
    rasDataset = DataSetConverter.Convert(dsProject)
    boSubreportClientDocument.DatabaseController.SetDataSource(rasDataset)
    When I try to set the datasource, I get "The document has no tables"   
    All the data tables required for the report to run are in the dsProject.
    Why do subreports need their dataset converted?  The main reportdocument.SetDatasource takes a normal .net system.data.dataset   ...but the SetDataSource on subreports need to be type ISCRDataSet   ...is this true?
    The report being used as a subreport references tables.  If I run the report as a standalone report, it works fine.
    Thanks,
    Jeff

    Hello Jeff,
    the code below does not use RAS but demonstrates how to pass Datasets to main and subreports in VB.NET.
    Please see if it is of any use for you.
    Thanks
    Falk
    'Purpose:       This Visual Basic .NET sample Windows application demonstrates how to
    '               pass a same dataset to the main report and the subreport
    ''All of these assemblies are required to be able to
    ''access, load, and set database logon.
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports System.Data
    Imports System.Data.OleDb
    Public Class Form1
        Inherits System.Windows.Forms.Form
        Dim crReportDocument As New CrystalReport1()
        Dim crOledbConnection As OleDbConnection
        Dim crOledbDataAdapter As OleDbDataAdapter
        Dim ds As DataSet
        Dim crSections As Sections
        Dim crSection As Section
        Dim crReportObjects As ReportObjects
        Dim crReportObject As ReportObject
        Dim crSubreportObject As SubreportObject
        Dim crSubReportDoc As ReportDocument
    #Region " Windows Form Designer generated code "
        Public Sub New()
            MyBase.New()
            'This call is required by the Windows Form Designer.
            InitializeComponent()
            'Add any initialization after the InitializeComponent() call
            'Connection information to connect to the database server to retrieve data
            'This is connecting to SQL server through OLEDB
            Dim ConnectionString As String = ""
            ConnectionString = "Provider=SQLOLEDB;"
            ConnectionString += "Server=Server1;Database=Pubs;"
            ConnectionString += "User ID=myuser;Password=mypassword"
            crOledbConnection = New OleDbConnection(ConnectionString)
            Dim sqlString As String = ""
            sqlString = "Select * From authors"
            crOledbDataAdapter = New OleDbDataAdapter(sqlString, crOledbConnection)
            ds = New DataSet()
            'Fill up the dataset
            crOledbDataAdapter.Fill(ds, "authors")
            'Set the datasource for the main report
            crReportDocument.Database.Tables(0).SetDataSource(ds)
            'Go through each sections in the main report and identify the subreport
            'by name
            crSections = crReportDocument.ReportDefinition.Sections
            For Each crSection In crSections
                crReportObjects = crSection.ReportObjects
                For Each crReportObject In crReportObjects
                    If crReportObject.Kind = ReportObjectKind.SubreportObject Then
                        crSubreportObject = CType(crReportObject, SubreportObject)
                        crSubReportDoc = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)
                        'Once the correct subreport has been located pass it the
                        'appropriate dataset
                        If crSubReportDoc.Name = "FirstSub" Then
                                crSubReportDoc.Database.Tables(0).SetDataSource(ds)
                            End If
                        End If
                Next
            Next
            CrystalReportViewer1.ReportSource = crReportDocument
        End Sub
        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer. 
        'Do not modify it using the code editor.
        Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer()
            Me.SuspendLayout()
            'CrystalReportViewer1
            Me.CrystalReportViewer1.ActiveViewIndex = -1
            Me.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
            Me.CrystalReportViewer1.ReportSource = Nothing
            Me.CrystalReportViewer1.Size = New System.Drawing.Size(292, 273)
            Me.CrystalReportViewer1.TabIndex = 0
            'Form1
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(292, 273)
            Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.CrystalReportViewer1})
            Me.Name = "Form1"
            Me.Text = "Form1"
            Me.ResumeLayout(False)
        End Sub
    #End Region
    End Class

  • How to refresh a crystal report automatically ?

    I deployed my website(asp.net/c#) in IIS 7.5, when i click on the button to open the page that contain the report, i get a blank page but when i refresh the page (F5) it's ok. my question is: how can i open the page that contain the report file directly
    without refresh?

    Tricky to guess without seeing any code.
    Here's some example code which fills and shows a report.
    protected void Page_Load(object sender, EventArgs e)
    ReportDocument rd;
    DataTable dt = (DataTable)Session["xxxxx"];
    // Tricky bit here is to make the name of the datatable match what the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load(Server.MapPath("Reports\\xxxxReport.rpt"));
    rd.SetDataSource(dt);
    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    CrystalReportViewer1.DisplayGroupTree = false;
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • Report Document.Load Method Hangs

    The following code is an exceprt from an asp.net web application we developed.  The report file (TestReport.rpt) file was designed using a 'manually' created schema (xsd) that mirrors the structure of pApptDT. The .xsd file has no DB connection info stored in it.  NOTE: the DBServiceORA and Registrations are base and middle tier classes respectively that do the heavy lifting.
    protected void Page_Load(object sender, EventArgs e)
        mDBService = (DBServiceORA)Session["DBService"];
        this.BuildReport();
    protected void BuildReport()
        ReportDocument pReport = new ReportDocument();
        try
            DataTable pApptDT = Registrations.GetApptSmry (mDBService);
            string pReportFile = Server.MapPath(Global.WEB_ROOT + @"/Reports_Appointment/TestReport.rpt");
            pReport.Load(pReportFile);
            pReport.SetDataSource(pApptDT);
            MemoryStream pStream = (MemoryStream)pReport.ExportToStream(ExportFormatType.PortableDocFormat);
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=Report.pdf");
            HttpContext.Current.Response.BinaryWrite(pStream.ToArray());
        catch (Exception ex)
            Response.Write("<p>" + ex.Message + "</p><p>" + ex.StackTrace + "</p>");
        finally
            pReport.Close();
            pReport.Dispose();
    This code has worked for over a year in our VS2008 development environment.  We use IIS, .Net 3.5, and ODP.Net with an Oracle 10g DB.  In our development environment we use IIS (not the built-in web server) which uses Windows integrated security.   My company recently pushed down new global policies to all desktops.  These new ploicies affected Local Security Policies and permissions on some files in the \windows\system32 directory.  When stepping through the code with the debugger, the application now hangs on the pReport.Load method.
    I need help in understanding the internals of the CR ReportDocument.Load method. We think the problem is somehow associated with CR trying to connect to a non-existent DB using some protocol that got affected by the policy changes. Can anyone shed some light on our problem, in particular what's happening inside the Load method.
    Thanks
    Dan

    Tried several options.
    OPTION 1:
    Created new VS2008 "Crystal Reports Application".
    'Manually' created schema (Activity.xsd) containing no DB connection information.
    Created Activity.rpt (that referenced the above Activity.xsd file).
    Created our 'normal' aspx page with code as follows:.
    DataTable pActivityDT = mDBService.GetDataTable("select * from E_ACT;");
    string pReportFile = Server.MapPath(@"/CRTestApp1/Activity.rpt");
    pReport.Load(pReportFile);
    pReport.SetDataSource(pActivityDT);
    MemoryStream pStream = (MemoryStream)pReport.ExportToStream(ExportFormatType.PortableDocFormat);
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ContentType = "application/pdf";
    HttpContext.Current.Response.AddHeader("Content-Disposition", "inline; filename=Report.pdf");
    HttpContext.Current.Response.BinaryWrite(pStream.ToArray());
    First attempt at displaying the above page results in making it past the pReport.Load but hung on the pReport.SetDataSource.  All subsequent attempts hung on the pReport.Load method. (?????)
    OPTION 2:
    Usng the VS-generated Default page (which included the CR Viewer) the ReportSource was set declaratively as follows:
    <form id="form1" runat="server">
        <div>
            <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
                Height="1039px" ReportSourceID="CrystalReportSource1" Width="901px" />
            <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
                <Report FileName="Activity.rpt">
                </Report>
            </CR:CrystalReportSource>
        </div>
    </form>
    Attempting to display the above page results in the application hanging.  I also tried setting the source to a non-existant file just to see if an exception would be thrown.  I got the expected 'Load report Failed' message followed by parital rendering of the CR viewer.
    OPTION 3:
    The report displays as expected when a new connection (pproviding the DB login credentials) is created in the CR Database Expert dialog screens and the Activity (E_ACT) table is selected and used as the datasource for the report.  With this option, the designer displays data from the Activity table in the Main Report Preview screen.  When running the application the CR Viewer prompts for DB login credentails.
    Hope this  sheds some light on the issue we're having.
    Dan
    Edited by: Dan Cannon on Dec 10, 2009 7:23 PM

  • How to create an editable previewable report?

    The Situation (the report is  CrystalReports.Engine.ReportDocument):
    I load the report (.Load(Template)) and  set data (.SetDataSource(DataTable)). I save the report (.SaveAs or .Export). The Template does not necessary contains fields in DataTable used as datasource.
    When I open the created report in "Crystal Reports 2011" the report preview is shown.  When I switch to the design tab I can drag fields to the report, but when I switch to the preview again a dialog asking for ado.net xml datafile is shown and when canceled (I have no datafile) empty preview is shown. In Visual Studio 2010 (CRVS 2010?) I see the preview when I cancel the dialog and click the design and  the preview again.
    The Question:
    Is it possible to create a report containing data with the preview working after report is edited?
    Note:
    I can achieve the desired behavior with external data file, but this soulution is not very convenient.

    Ah... that helps a lot...
    A couple of ways to go about this. From your template report compare the fields that exist in the report with those your Query has and add them into the Report. You can use the Command Object to append the fields and then the report will need to be refreshed against the XML file. In this case though the report will need to be ran again.
    Another option is to export your data from your Query into a DataSet and simply .setlocation to the DS, great for small amounts of data, less than 2K rows or so but you'll have to test for the limits.
    Another option is to to use RAS to completely create the report from nothing. See these samples on how to:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsSDKSampleApplications
    Bottom line is if you change the fields in a report it is going to have to be refreshed so the report can add/update the field reference list saved in the RPT file. If they don't match CR will simply delete all fields it can't match up.
    If using RAS to Create the report and set it to the new field list then you can build your own "Report Designer"
    As for running the Query again, that depends on how and where the data exists. If you save your date results into an XML file then it won't hit the DB again.
    This will generate the XML file:
                ds.WriteXml(@"D:\Atest\list_of_workflows.xml");
                ds.WriteXmlSchema(@"D:\Atest\list_of_workflows.xsd");
    Then load the XML file into a Dataset and then simply use:
    rpt.SetDataSource(ds);
    To set the Report to the XML file.
    XML is the preferred way and it doesn't have any memory limitations as Active DataSets do. ( MS limitation due to security, CR can't access the original so we have to make a copy which effectively doubles the amount of memory required )
    Don

  • Crystal Reports prompt issue on export: "The report you requested requires further information"

    I have searched through forums for a solution but none seem to work for me.
    I have an ASP Webform/MySql application which displays Crystal Reports.
    The ones which do not require a user to enter a parameter display fine and I am able to click on export on the CR toolbar and download, e.g. .pdf format.
    On the report that require a user to enter a parameter, the report renders fine but when I click on the export button, i get the prompt:
    "The report you requested requires further information"
    asking for DB login credentials. How can I avoid this?
    My Code:
    Aspx page:
    <%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
    <div>
              <CR:CrystalReportViewer Width="960px" ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
    </div>
    protected void Page_Load(object sender, EventArgs e)
             if (Request.QueryString["report"] != null)
                    string reportToGet = Convert.ToString(Request.QueryString["report"]);
                    switch (reportToGet)
                            case "payslip":
                            PaySlip();
                            break;
                            case "pastpayslip":
                            PanelPastPaySlip.Visible = true;
                            break;  
                           default:
                           break;
    protected void btnSearch_Click(object sender, EventArgs e)
          if (txtDate.Text != null || txtDate.Text != string.Empty)
          if (DateTime.TryParseExact(txtDate.Text, "yyyy-MM-dd", CultureInfo.InvariantCulture,
          DateTimeStyles.None, out date))
          PastPaySlip();
    private void PastPaySlip()
                // Some code....
                PayMasterDataSetTableAdapters.pastpayslipcasualviewTableAdapter ta =
                    new PayMasterDataSetTableAdapters.pastpayslipcasualviewTableAdapter();
                PayMasterDataSet.pastpayslipcasualviewDataTable dt = new PayMasterDataSet.pastpayslipcasualviewDataTable();
                ta.FillBy(dt, userId, businessId);
                cReport = new ReportDocument();
                string reportPath = Server.MapPath("~/Views/CasualLabour/Reports/PastPaySlip.rpt");
                cReport.Load(reportPath);
                cReport.SetDataSource((DataTable)dt);
                cReport.SetParameterValue("Date", date);
                cReport.SetDatabaseLogon("userID", "password", "server", "database");
                CrystalReportViewer1.ReportSource = cReport;
                CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
    I am using CR V. 13.0.9 and VS 2013 Update 2

    This is because almost any action on the viewer result sin a postback. This includes paging, zooming, drilling exporting and printing. E.g.; you will have to place the report in session. See the following KB for how to:
    1985571 - How to use sessions in web applications using the Crystal Reports viewer (the complete code)
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Crystal report in wpf

    hi i am new in WPF.
    How to i can use crystal report in WPF?
    is their any help..?

    The documents tend to tell you to use odbc, this is a bad idea.
    Don't just read the data in the report.
    You want to get your data yourself and supply it to the report.
    Build your report against a fixed table or stored procedure but don't use that directly when live.
    If you have a datatable then that's probably the easiest option.
    You want a source of data to design your report against and the simplest is a stored procedure or a table.
    You can create a table temporarily for this, or even use xml but you need something concrete to design against.
    A stored procedure should have only one output - use
    Set Nocount on
    Or you'll have two.
    Build your report against that table or stored procedure ( the option to "see" stored procedures is a bit fiddly to find ).
    You won't use that live though.
    Print preview will involve the viewer, so you're going to put a crystal report viewer on a window or whatever.
    And here's some code should give you an idea.
    This is out an old asp.net application -  you will obviously not be using server mappath to find your report file.
    protected void Page_Load(object sender, EventArgs e)
    ReportDocument rd;
    DataTable dt = (DataTable)Session["xxxData"];
    // Tricky bit here is to make the name of the datatable match what the report expects
    dt.TableName = "DataTable1";
    rd = new ReportDocument();
    rd.Load(Server.MapPath("Reports\\xxxReport.rpt"));
    rd.SetDataSource(dt);
    rd.Refresh();
    CrystalReportViewer1.ReportSource = rd;
    CrystalReportViewer1.RefreshReport();
    CrystalReportViewer1.DisplayGroupTree = false;
    I adapted someone's code for them to answer another question which ended up:
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.5; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoR", con);
    cmd.CommandType = CommandType.StoredProcedure; ..........
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    ReportDocument objRpt = new Reports.CrystalReportData1();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    Please don't forget to upvote posts which you like and mark those which answer your question.
    My latest Technet article - Dynamic XAML

  • JRC & C++ ???

    Hi
    I've just downloaded crystal reports for visual studio 2010, i created a report linked to an xml file which i generated by the .NET dataset.writexmlschema method.
    I tried to do this:
    CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    rptDoc.Load("demo.rpt");
    rptDoc.SetDataSource((DataTable)tablaS);
    crystalReportViewer1.ReportSource = rptDoc;
    But it throws an exception at Load()
    it's in spanish but it refers to something like (in innerexception) "a document processed by JRC engine cannot be open in C++ stack" ( Un documento procesado por el motor JRC no se puede abrir en la pila C++.)
    what might be happening?
    thanks in advance

    Hi Ludek
    I have the same problem.
    I use the full path to the report but still no luck.
    I have tried to use  different methods.
    Nr 1: Open method
    =====================
    Dim crGeneratedReport As New ReportClientDocument()
    crGeneratedReport.ReportAppServer = String.Format(":", rasURL, RASPort)
    crGeneratedReport.ReportAppSession.Initialize()
    crGeneratedReport.Open(CType(filePath, Object), 1)  --crash here
    Nr 2: Load method
    ===================
    Dim rptDoc  as CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument()
    rptDoc.Load(m_ReportFilename, m_ReportServer) --crash here
    crystalReportViewer1.ReportSource = rptDoc
    I have also tried changing the path and I can even open the folder on the remote server from my pc in explorer(start/run box, path) by using the same string as I send, but no luck.
    The report file that I want is on the report server, and this worked well in CR2008, but now it seems something has changed.
    What can be the problem?
    Is there a service pack that can help?
    regards Uffe

Maybe you are looking for

  • How to delete a master record with transaction data?

    Hi,     Iam able to delete master record(GL/Vendor/Customer)through OBR2 when there is no transaction data in those respective master records. Despite of clearing all open items in a particular vendor Account, Iam unable to delete that master record.

  • How to create a Navigation with submenu ? { Mega Navigation Menu} ?

    Please iam playing around with Flach Catalyst, but i cant find how to create a navigation menu with submenus i've created the design in photoshop but i dont know how to do the rest in Catalyst. the Navigation menu that i want is should be more or les

  • Set/change dynamic header configuration from ABAP Proxies

    This question is with reference to Async ABAP Proxies. Is it possible to set or change dynamic configuration header of an outbound (client) proxy, from within an inbound (server) proxy ? If it is, how do I do it? Can someone please advise? Thanks, Ba

  • Zen neeon prob

    Hi, I've been using Creative Zen Neeon GB for about ,5 month, but I've been experiencing a problem since i bought it. My mp3 player doesn't work correctly. It's often (getting more often these days) turning off just after "Please wait" warning while

  • Leopard 10.5.2 - Mail sent but not recieved

    Hi I upgraded to 10.5.2 and have been having a strange problem with mail since then. I have 5 email accounts (4 yahoo and a gmail account) setup in mail and have checked all pop and smtp settings are correct. Since the upgrade although all messages e