Crystal Report Dynamic Creation

I have come up with the need for the dynamic generation of report depending upon the user selection. actually the number of columns in the table keep varying thus the schema of the table is also not fixed. thus table is also to be generated dynamically, i have been able to make a data table dynamically, thinking that it may be given as the report source to the report but have not been able to achieve it. so what i need is the way by which i can provide the schema for the same to the report and fill in the data that i have in my table dynamically.

hi Siva,
there is a way to do this but if you're new to crystal it may not be something that you want to do yourself.
as Sastry mentioned above there is an option to add a Command object to use as your datasource. creating a Command like the following, where there are a bunch of parameters can create a dynamic field report. so if you're good with sql then writing out the command should be no problem.
SELECT
{?Field1} AS Field1,
{?Field2} AS Field2,
{?Field3} AS Field3,
{?Field4} AS Field4,
{?Group1} AS Group1,
{?Group2} AS Group2,
{?Summary} AS Summary
FROM
((((`Customer` `Customer` INNER JOIN `Orders` `Orders` ON `Customer`.`Customer ID`=`Orders`.`Customer ID`)
INNER JOIN `Employee` `Employee` ON `Orders`.`Employee ID`=`Employee`.`Employee ID`)
INNER JOIN `Orders Detail` `Orders_Detail` ON `Orders`.`Order ID`=`Orders_Detail`.`Order ID`)
INNER JOIN `Product` `Product` ON `Orders_Detail`.`Product ID`=`Product`.`Product ID`)
INNER JOIN `Product Type` `Product_Type` ON `Product`.`Product Type ID`=`Product_Type`.`Product Type ID`
i had originally written something like this out, i.e. an ad hoc report, in the webelements library but it is a very old sample and will probably no longer work. it uses the above syntax with a dynamic filter passed from a main report to a subreport. if you go to the above blog there's a sample report you can download. you'll be on your own to get it to work though as i mentioned it is quite old.
and attached is an example of a report where the end user can quickly switch up the fields that are on a report. it does not use dynamic sql though, but is an example of formatting a report to switch the fields. if you want to view it extract the contents and change the .txt extension to .rpt.
so, if you create a Command object that dynamically assigns the schema.table.fields then you can use the attached sample report as a guide on how to do the formatting piece.
-jamie

Similar Messages

  • Creating Crystal Reports Dynamically from an incoming SQL query

    Hi,
    I have a requirement where a sql query will be entered by the user in a text box and in the back end java code, i have to create a crystal report dynamically based on that sql query and show it in the crystalviewer object.
    For example if the user writes "select x,y from xtable ", i should be able to create a report with 2 fields, and if the user says "select x,y,z from xtable" then i should be able create and show a report with 3 fileds...thsi report creation should be done in the click event.
    Is this possible in java? I have found something similar in .NET... pls have a look at this 
    http://vb.net-informations.com/crystal-report/dynamic_crystal_report_from_sql_query_string.htm
    Thanks,
    Preethi

    Hi Preethi,
    Can you please share the steps with me? I am also looking for dynamic SQL being applied to the crystal report.
    Thank you so much for your help in advance.
    Regards,
    Janakiram D.

  • Crystal Reports Dynamic Parameters with SAP Business One

    Okay, I've got this very strange issue with dynamic parameters in Crystal Reports connected to SAP Business One.
    Let's start with the software versions:
    - Crystal Reports 12.3.0.601
    - SAP Business One 8.8 (8.80.231) SP: 00 PL: 13
    - Windows XP SP3
    (SBO Server on Windows 2003 and SQL 2005)
    What I'm about to describe is something I've tried in several reports and for which I created a very, very simple test report to see if it was reproducible in a very simple situation.
    - I connected to a Business One server through CR's SBO connection type. Logon is successful, tables are shown.
    - I pick OCRD and plac CardCode and CardName in the details section on the report. Previewing the report shows data.
    - I create a dynamic parameter on CardCode and in the Select Expert I select the CardCode field and define that that should be equal to the parameter.
    - I preview the report again. Now it asks me in such a parameter screen for logon credentials. It shows the server and database it tries to connect to and in the username it shows the SQL Server username I used to connect to the SQL Server in the first place. However, the password for that user is not accepted. I also tried to login with the Windows administrator user and with the SBO manager user, but no success with any attempt.
    I also tried to add a static parameter and add all database values to the list. Same screen, different result:
    Crystal Reports 2008 wrote:
    Logon Failed.
    Error in File UNKNOWN.RPT:
    Unable to connect: incorrect log on parameters. (rptcontrollers.dll)
    (On a side note: the report is saved as report1.rpt)
    Anyone else got similar issues and found a solution?

    Hi,
    When you have fixed your crystal installation following the note posted earlier, please take a look at the [how to guide|http://service.sap.com/sapidb/011000358700000882232009E.pdf] and also at the [e-learning|http://service.sap.com/sapidb/011000358700001370262010E] about SAP Business One 8.8 and Crystal Reports.
    There are so called "tokens" which you need to use instead of dynamic parameters.
    Dynamic paramters don't work in SAP Business One 8.8, if they are not defined as a static paramter with token.
    Best regards,
    Darius

  • Displaying a user logo in a Crystal Report dynamically at run time

    Using Visual Studio 2010, CR for VS 2010 on a Win 7 64 bit dev machine.  The software app that I'm creating is a full Windows application (not for the web).  Compiling my app for .NET 4.0.
    Actually, in January, 2012, we purchased the CR 2011 full version and subsequently installed this version for use within the development environment (VS 2010).  References that I use show (for example) CrystalDecisions.CrystalReports.Engine version 13.0.2.
    I have hundreds of hours of experience using Crystal Reports within VB, dating back to VB 6 and CR 8.5.  In a software app that I am currently writing, (where I am using VB in VS 2010 and CR 13.0.2), the Graphic Location formula within a picture "placeholder" is not working.  I am using a parameter called pUserLogo to set the path to the graphic location at runtime, but to no avail.  The picture that I'm using as a placeholder is not changing at runtime.
    I have scoured the internet for solutions to this problem.  I have also attempted to upgrade both the CR for VS 2010 (a.k.a. CR developer version) as well as the CR runtimes (both the 32 bit and 64 bit versions), but this has not helped.  The picture is never replaced at runtime while working within the IDE (i.e. running the app from VS, nor after compiling and then running as a full-blown application).  I have also tested this on another development machine.
    I eventually gave up trying to use the Graphic Location formula method, and instead went with a method that uses a DataSet within a DataTable to set the image (of an image column) as posted online.  This method actually works within the IDE.  However, if I then install my app to another PC (Win 7 64 bit as well), the CR crashes the app.  After extensive searching online, I found that referencing a DataSet in VS 2010 inside a CR, led to many other issues, such as having to use the 'useLegacyV2RuntimeActivationPolicy=true' statement in app.config.
    Further, I read that using a DataSet within CR in VS 2010 meant that you had to compile for .NET 3.5, rather than 4.0.
    Eventually, I created restore points on both PC's and then upgraded everything to 13.0.6.  But this did not help either method.
    All I am trying to do is 1) let the user of my app select an image before the report is created, and then 2) display that image on the report.  This particular report doesn't even need to reference any database, as all of the numbers that I'm displaying in the report are simply parameters that I update during the report's creation.  It is a very simple, straight-forward report.
    I would be happy to setup a GotoMeeting so that someone at support could see what is happening and could also review the code.  There are many more details, such as what errors I've encountered along the way, and what web sites I've been to in researching these issues, but I will leave that for continued discussion.
    Regards,
    Dominic

    An older discussion on this issue can be found at:
    http://stackoverflow.com/questions/2548723/unable-to-programically-set-graphic-location-in-crystal-report
    Since I couldn't get this method to work, I then tried the method as described here:
    http://adf.ly/91637/banner/aspalliance.com/1097_Importing_Dynamic_Images_to_the_Crystal_Report_without_Database_Overhead_using_Visual_Studio_2005.all
    The second method, which uses a DataSet within a DataTable as described in the above link, does work, and it correctly displays the image, but only in the IDE.  When tested on a "client" machine, opening the report causes my app to crash, with no exception or error message except for the "...has caused the application to stop working".  Previously, before introducing said DataSet into the report, the report loads and displays fine on my client machine.
    Further research led me to these two threads concerning the usage of the crdb_adoplus.dll which is necessary when using a DataSet in VS 2010 with CR.  It seems that the folder dotnet1 is not accessible, and thus there are workarounds for this issue.  See these two threads, below:
    http://scn.sap.com/thread/1802638
    http://scn.sap.com/thread/1665437
    Again, I followed the recommendations that I needed to set the Startup flag 'useLegacyV2RuntimeActivationPolicy=true' in app.config.  However, the workaround where I should target .NET 3.5 instead of .NET 4.0 is not reallly an acceptable option to me (and I don't know if it will work, anyway).
    So my question remains; Can anyone please tell me if A) They have any issues using the "picture placeholder/formula" method for loading a picture at runtime, and/or B) If there is a fix for the DataSet issues apparently inherent in using VS 2010 with a Crystal Report?
    Thanks in advance, for your reply.
    Regards,
    Dominic

  • Crystal Report Dynamic Parameter for SAP B1 version 8.8

    Hi, does anyone have problem with the dynamic parameter prompt for Crystal Report in SAP B1 version 8.8?
    For example:
    1. For static parameter that allows multiple value --> In SAP B1 v8.8, there is a check-box and a "..." button next to it. When you click the "..." button, a new window appear with a list of values to choose.
    2. For static parameter that does not allow multiple value --> In SAP B1 v8.8, there is one field with a drop-down menu.
    3. For dynamic parameter that allows multiple value and does not allow range values --> In SAP B1 v8.8, just one field for us to key in the value. Shouldn't this be the same as No. 1?
    4. For dynamic parameter that does not allow multiple value  and does not allow range values --> In SAP B1 v8.8, same as No.3 above. Shouldn't this be the same as No. 2?
    How do I get no. 3 dynamic parameter that allows multiple value and does not allow range values  to have a check-box and a "..." button next to it to allow us to select multiple values?

    Hi Shwu Hua Gan,
    Thank you for your reply.
    Please forgive me as I don't really understand what you are saying here. To be honest, I'm very new to Crystal Report and my understanding of CR is just the very basics. I'm actually not from a technical background which makes it more difficult.
    In your reply:
    Ie, you create a parameter in Crystal report, and by using the token eg:Mytest@select * from OCRD, it gives you the benefits of selecting the list from the database.
    How do you do this by using the token? All I did is just select the parameter type (dynamic) and then select the table. When I preview the report in SAP B1 8.8, it doesn't prompt me like how I expect it to be. It is a blank field that I have to key in the value myself and then only the report will generate. Sometimes I don't remember what value to key in, so I have to do a formatted search for the blank field. After the report is generated, I can reselect the value (multiple values) from the CR viewer panel toolbar and refresh the report.

  • Crystal Reports dynamic parameter does not work in InfoView

    Hello,
    We have developed Crystal Reports in CR2008 on top of SAP infoset and we have one of our selection parameter as dynamic parameter. It works fine in the CR Dev tool but when i upload the report in the InfoView, report does not show any value in the "Available Values"
    Any input will be much appreciated.
    Thanks.

    I did found the solution for this, i had to go into Business View Manger (BO Client Tools) and Schedule the LOV (List of Values). This is odd setting! but it works....

  • Crystal Reports dynamic parameters data source

    Database: Sybase ASA 9
    Crystal: Developer 11 SP4 , activex viewer
    Application: Powerbuilder 11
    I am embedding crystal reports into a powerbuilder 11 application. The crystal reports (.rpt files) are created in Crystal reports developer 11 sp4. The application programmatically change the DSN for the crystal reports to connect to the database that the customer is using. This works fine except when the report contains dynamic parameters (parameter select values from table in database to select from). The dynamic parameter(s) still references the DSN used in development as appose to the new (changed) DSN , although the rest of the report use the "new" DSN. I have spend many many hours on this and are at a lost on how to fix this ?
    Following is in short the code I use:
    FOR li_table = 1 TO iole_crx_report.database.tables.count
    // get connection properties collection for this table
    iole_crx_connection_info = iole_crx_report.database.tables[li_table].connectionproperties
    iole_crx_connection_info.DeleteAll()
    iole_crx_connection_info.add("DSN",itrx_database_info.Lock )
    iole_crx_connection_info.add("User ID",itrx_database_info.userid)
    iole_crx_connection_info.add("Password", itrx_database_info.dbpass)
                                                  iole_crx_connection_info.add("UseDSNProperties",TRUE)
                                  iole_crx_connection_info.add("AllowCustomConnection", TRUE)
    NEXT
    iole_crx_Database.Verify()

    Hi, Johan;
    There is no SDK option to change the datasource that the dynamic parameters are based on. Your only option would be to change the DSN itself to point to the new database. Or, not use dynamic parmeters.
    Regards,
    Jonathan

  • Can you integrate Crystal Reports dynamic charts onto DW?

    Is there a way that I can drag/drop or integrate dynamic/live
    charts that were built in Crystal Reports into Dreamweaver? I am
    designing the company website and would like to use Crystal to
    create our live graphs/charts and then integrate these charts into
    DW so people can see them on the site. These charts will be live
    and constantly updating so I'm not sure if this is possible...
    Has anyone tried this?
    Thanks!

    I haven't tried this. But wondering why you're not using
    Microsoft product such as Visual Studio or Visual Web Developer
    (free from web too from MS) to try this.
    I know Dreamweaver can't do ASP.NET 2.0 and above. So if
    you're going to be doing anything with C# or VB.NET I would look at
    Microsoft instead of DW.
    I know Crystal Reports work well with Visual Studio

  • Create Crystal Report Dynamically using XML based design metadata

    Hi,
    I have a CR Report Development environment. Please refer to workflow and requirement description below;
    I have a Java application(Report Customization Tool), which allows users to dynamically select structure and content for a report.
    The process goes as follows:
    1. In Java Application, user first gets option to select Report Header, Page Orientation, Font etc for master report.
    2. User can select a sub-report (pre-developed report frames. Not Sure about tool.) and apply the same format option (mentioned in step 1, except orientation) to it.
    3. User can select individual row/data cell to be displayed on the report through reference to DB tables in sub-reports.
    4. There can be N number of sub-reports each with independant formatting, data and data layout that could be integrated in single report.
    5 Once all selection is done, Java code generates an XML with all this info.
    Now, my requirement is dynamically write CR report based on this XML. I am not using BO enterprise, hence RAS SDK is out of scope. This report will be called thorough stand-alone .NET application in CITRIX environment.
    Can we do it in CR XI/CR 2008?
    Please feel free to comment in case you need more info. But I won't be able to post screenshots. NDA of course!
    Thanks in advance.

    I moved your post to the NET - SAP Crystal Reports forum.
    To start, you have a fair bit of work ahead of you. The Crystal reports SDK will not do the job. You will have to use the InProc RAS SDK which is included in both CR XI and CR 2008. I'd recommend going with CR 2008 as CR XI R1 (11.0) is out of support now and CR XI R2 (11.5) will be out of support come June of 2011. Next, make sure you have applied SP 3 for CR 2008:
    https://smpdl.sap-ag.de/~sapidp/012002523100007123572010E/cr2008_sp3.exe
    As an FYI, all files can be found on the downloads page:
    http://service.sap.com/sap/bc/bsp/spn/bobj_download/main.htm
    Next, you want to read up on RAS. I suggest the following:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b840c0-623f-2b10-03b5-9d1913866b32
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b050afe0-2fa5-2b10-658d-98f214ba6a4a
    http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_dg_12_en.chm
    Samples are here:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples
    and here:
    http://www.sdn.sap.com/irj/boc/samples?rid=/webcontent/uuid/80774579-b086-2b10-db91-ed58c4dda375 [original link is broken]
    I also find this 3rd party link useful:
    http://book.soundonair.ru/sams/
    And as always, search these forums. Lots of info here. E.g.;
    Programaticaly add Table in CR database fields
    InProc RAS Issue
    Adding the columns dynamically in crystal report
    Also, see the search box at the top right of this page. It searches blogs, wikis, Kbases, articles and more - all in one go.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Crystal reports dynamic

    Hello people  I've got a question about the versions of crystal reports, does crystal reports basic for visual studio 2008 has the functionality to print dynamic columns???? in that case can you tell me how, or do I have to buy the Crystal Reports 2008 version?????
    thanks for the reply xD

    Adding to Jason's reply.
    You'll want to refer to the [Developer Guide|https://boc.sdn.sap.com/node/10619] on our [Diamond |https://boc.sdn.sap.com/]website for more information.
    Check out the [samples |https://boc.sdn.sap.com/codesamples]too.

  • Crystal Report Dynamic connection issue ORA-04043 Database Vendor Code 4043

    HI All,
    Ii am getting dynamic connection issue with Crystal Report 2008 and Business View Manager, i have Oracle database,
    i have done following steps
    1 Creating Dynamic Connection (including two connection XDC & YDC)
    2. Creating Data Foundation (Common object available in both connection ie. stored procedure)
    3. Creating Business View (with selected number of elements in business element, like firsta name, lastname)
    I have verified database connectivity from Business view manager, both the connection are working fine bringing different number of rows from two different schemas (different schema but same objects in two schemas)
    4. Database connectivity to different database schemas
    5. Connectivity from Crystal Report (done the connectivity from the repository to business view )
    6. Report Connectivity with first schema shows records
    7 Report Connectivity with second schemas shows error
    as follows Failed to retrive data from the database & on clicking of detail i get following error
    Crystal Reports
    Database Connector Error: 'ORA-04043: object HR.EXCEPTION_REPORT_SUB1_PROC [Database Vendor Code: 4043 ]'
    Q first of all i need to know if dynamic connection using business view manager and crystal report technically possible or not, if yes then please let me know the solution, since we did verified with SQL database and ite work with two different database.
    Q if not possible then are there any options to resolve dynamic deployment of crystal report over multiple schemas with crystal report 2008
    Any help or suggestion will be appriciated, hope some one might have got similar issue
    Thanks in advance
    Edited by: smunir on Jul 12, 2011 9:18 AM
    Edited by: smunir on Jul 12, 2011 9:41 AM
    Edited by: smunir on Jul 12, 2011 9:43 AM

    Hi,
    When i use same credentials in Tod or sqlplus it works perfect and gives appropriate results. But when i use same credentials using business view manager, the very first connection works but the second connection does not work
    Please suggest!
    Regards,
    <<smunir>>

  • Adding parameters to crystal reports dynamically

    Hi,
    I am creating a report for employee salary where Basic,HRA,etc fields are shown.Now if a new field is added to database say Medical Allowance,then how to add the field in report without changing the report.i.e. all the fields in the database added to the database should be printed in report without modifying the report.
    Please reply.Thanks.

    Hi
    Without placing the field in report how that will be printed ?  Once you add the new field, unless you click on Verify Database, it will not be shown under Field explorer.
    I don't think you will be able to do this using tables..
    May be you can create a stored procedure and concatenate all field to a string and pass that string to report and print it.
    In this case also you need to modify the stored procedure.
    -Sastry

  • Dynamic crystal report generation - issues with column headings

    Hi All,<br>
    I'm trying to generate a crystal report dynamically based on a "result set" data(Query: select REPORT_ID, REPORT_NAME, REPORT_DESC, RPT_FILE_NAME, LOCATION from IRS_REPORT_DETAILS). I'm able to generate the report run time, But the report is without columns heads. I would like to include the column headings as well. <br><br>
    I searched the API(RAS) and found that there is a 'add(java.lang.String fieldName, java.lang.String headingText) " method present in "ReportObjectController" using which we can add the headings.<br><br>
    ReportDefController reportDefController = clientDoc.getReportDefController();
    ReportObjectController reportObjectController = reportDefController.getReportObjectController();
    reportObjectController.add( "{Table.Field}", "FieldName" );
    <br><br>
    I'm facing problems in using this code. When trying to use this function for my fields(Ex: reportObjectController.add( "{ IRS_REPORT_DETAILS.REPORT_ID}", "Report ID" );) it is giving me the following error:<br><br>"com.crystaldecisions.sdk.occa.report.lib.ReportSDKGroupException: The field was not found.---- Error code:-2147213310 Error code name:fieldNotFound"<br><br>
    <b>The following is my dynamic crystal report generation code:</b><br><br>
    public ReportClientDocument execute(String repName, String query) {
              ReportClientDocument boReportClientDocument = null;
              try {
                   boReportClientDocument = new ReportClientDocument();
                   boReportClientDocument.newDocument();
                      // Add a table based on the given Resultset to the report.
                   dbConnResultSet mySampleResultSet = new dbConnResultSet();
                   //mySampleResultSet.execute(query);
                   boReportClientDocument.getDatabaseController().addDataSource(
                             mySampleResultSet.execute(query));
                   IReportSource test = boReportClientDocument.getReportSource();
                   // Access all the database fields
                   DatabaseController databaseController = boReportClientDocument
                             .getDatabaseController();
                   IDatabase database = databaseController.getDatabase();
                   Tables tables = database.getTables();
                   ITable table = (Table) tables.getTable(0);
                   int NO_OF_FIELDS = table.getDataFields().size();
                   int LEFT_POSITION = 200;
                   // Add all the database fields to the report document
                   for (int i = 0; i < NO_OF_FIELDS; i++) {
                        IField field = table.getDataFields().getField(i);
                        FieldObject fieldObject = new FieldObject();
                        fieldObject.setFieldValueType(field.getType());
                        fieldObject.setDataSource(field.getFormulaForm());
                        IReportObject rep = (IReportObject) fieldObject;
                        IObjectFormat objformat = rep.getFormat();
                        objformat.setEnableCanGrow(true);
                        objformat.setHorizontalAlignment(Alignment.from_int(1));
                        rep.setFormat(objformat);
                        rep.setLeft(LEFT_POSITION);
                        rep.setWidth(1000);
                        LEFT_POSITION = LEFT_POSITION + 1000 + 50;
                        ISection section = boReportClientDocument
                                  .getReportDefController().getReportDefinition()
                                  .getDetailArea().getSections().getSection(0);
                                   //***************** Data being added to the report here, But headings are not added*****************
                        boReportClientDocument.getReportDefController()
                                  .getReportObjectController().add(rep, section, i);
                   boReportClientDocument.createReport();
                   /*Some report saving code is present down*/
              } catch (ReportSDKException ex) {
                   ex.printStackTrace();
              } catch (Exception ex) {
                   ex.printStackTrace();
              return boReportClientDocument;
    <br><br>
    appreciate your help.

    IField field = table.getDataFields().getField(i);
    Here you are getting the first field in the array.  This may not be the field you want to add since we aren't sure how the arrays are ordered when retrieving fields from the report.  It is better to retrieve the fields with the findObjectByName method, thus ensuring you are retrieving the field you want to add to your heading.

  • How to pass database login information to a crystal report using c#?

    Hi,
    I need to pass database logon information to a crystal report dynamically using c#.  I am developing a windows application using c# .Net.
    I looked some of the articles however I am not able to figure out the mistake I have did.  Please find below the code I have written so far; It would be great if you could help me out in solving the issue.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    using System.Data.OracleClient;
    using System.Configuration;
    using CrystalDecisions.Shared;
    using CrystalDecisions.CrystalReports.Engine;
    private void Frm_report_Load(object sender, EventArgs e)
                setReportParameters(); // method to pass parameters to the Crystal report
                crystalReportViewer1.ReportSource = new Upper_Lower();  // Upper_Lower is the Crystal report I have used in my project
               TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
               TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
               ConnectionInfo crConnectionInfo = new ConnectionInfo();
               Tables crTables;                            
                    crTables = new Upper_Lower().Database.Tables;
                    crConnectionInfo.ServerName = "oops";
                    crConnectionInfo.DatabaseName = "";
                    crConnectionInfo.UserID = "new";
                    crConnectionInfo.Password = "new123";
                    foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in crTables)
                        crtableLogoninfo = CrTable.LogOnInfo;
                        crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                        CrTable.ApplyLogOnInfo(crtableLogoninfo);
    Thanks & Regards,
    Karthik.

    Hi,
    Try using this code ,
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using CrystalDecisions.Web;
            ReportDocument rd = new ReportDocument();
            rd.Load(Server.MapPath("Report name"));
            rd.SetDatabaseLogon("User Name", "Password", "Server Name", "Database Name");
            CrystalReportViewer1.ReportSource = rd;
    [See Also.|http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/devsuite.htm]
    Hope this helps!!
    Sincerely,
    Nikhil Dharme

  • How to overcome the Memory leakage issue in crystal report 2008 SP2 setup.

    I have developed the small windows based application tool with help of  Visual studio 2008 for identify the memory consumption of crystal report object. It helps to load the crystal report objects in the memory and then released the object from the memory. The tool simply does the u201CLoading and Unloadingu201D the objects in the memory.
    The tool will be started once u201CTest_MemoryConsumption.Exeu201D executed. The u201CTest_MemoryConsumption.Exeu201D consumes u201C9768 KBu201D memory before load the crystal report object in memory. It means, 9768 KB is normal memory consumption for run the tool.
    Crystal report object initiated by the tool and object help to load the report in memory once the tool initiated the crystal report object. Now u201CTest_MemoryConsumption.Exeu201D consumes u201C34980 KBu201D memory during the crystal report object creation and report load process. The actual memory consumption of crystal report object is 34980u20139768=u201C25212u201DKBu201D. 
    The memory consumption u201C34980 KBu201D will be continued till the end of the process. The memory consumption will be reduced to u201C34652 KBu201D from u201C34980 KBu201D once report load process completed. It means, u201C328 KBu201D memory only released from the memory consumption. Tool enables the Release command for the crystal report object. But crystal report object does not respond to the command and will not release his memory consumption.
    The memory consumption u201C34652 KBu201D will be stayed in the memory once job ends.  If i again initiate the crystal report object then it crystal report object start to consume the memory from 34652 KB.
    Database objects and crystal report objects are properly used in the tool. The object release commands properly  communicated to crystal report setup. But the u201CCrystal report service pack 2u201D setup unable to respond the commands which has enabled from .Net Tool.  Crystal report objects are properly initiated and disposed in the tool. But the crystal report unable to release from the server.
    The memory consumption will be reduced once the server restarted or kill the application.
    Crystal report 2008 and crystal report 2008 SP2 setup available in the server.
    Microsoft .Net Framework 2.0 SP2, Microsoft .Net Framework 3.0 SP2 and Microsoft .Net Framework 3.5 SP1 are available in the server,
    Could you please suggesst how to avoid the memory consumption keep increasing and  how to release the memory consumption  once the crystal object disposed???

    Hi Don..
    My case is different one. I hope, the problem with Run time Installation setup file (Crystal report 2008 Serivce Pack2 installer) which we installed in the server.
    Let me explain with Live scenario which our client faced in crystal report 2008 Service pack2 Installer.
    Our client is using a application to help to print their reports. The application is developed with Windows service.
    Windows service keep on running in the server. Windows service executes the client 's crystal reports( Labels Report, Stock  report) which designed for clients need and the reports will be printed from printer. 
    10 Same type report (Label Report) will be printed in 1 minute. Reports are not printing during non business hours. But the windows service keep on running.  Memory cosumption of application will be 160 MB in business hours.
    For Example, On Monday the application memory consumption starts with 160 MB. The Memory consumption will be reached 165 MB  in peak business hours. Then the memory will be ended in163 MB in the End of Monday. It means, The memory consumption will be in 163 MB during the non business hours. Reports will not be printed in non business hours.
    On Tuesday, the application memory consumption starts with 163 MB and it will be reached 168 MB during the peak hours. The Memory consumption will be ended in 165 MB in the end of Tuesday.  The same process contiues till friday. End of friday, the memory consumption of the application will be ended with 170 MB.
    Application Memory Consumption slowly increasing in the server. In 5 days, Memory consumption reached Threshold value (170 MB) of the server. Application gets hanged up once the memory consumption reached 170 MB. We got the error messages as "Attempted to read write protected memory " / "Not Enough memory for process".  If we restart server / If we restart the service then memory consumption of application get reduced to 160 MB.
    From the above scenario, We came know that the either the problem with Application object or the problem crystal report object. In the application, We have checked dispose methods of application objects completly. I am sure that  application objects are properly disposed in the application. I hope the problem not with application objects. The problem with Crystal report objects.
    Application properly communicates the dispose methods to crystal report objects. Crystal report objects are not released from
    the memory.
    Crystal report 2008 Serive Pack 2 setup installed in the server. 
    As you said, If Crystal report runtime is not released from memory then memory consumption keep increase???  In service oriented architecture application, how to unload the crystal report runtime??
    Do you any fix for this kind of issue??
    Willl Crystal report 2008 service pack 3 help on this issue??

Maybe you are looking for