Crystal Reports 2008 - Changing Table Locations

Hello,
we have several reports which we use by different customers. The customers use different name spaces (table locations) for the same data. To use the same reports with different table locations, we wrote a piece of software replacing the connection strings and table locations. 
Example:
A report should be used in a test environment as well as in a production environment:
  The original SQL is (using a DB2 database on a AS400):
    SELECT alias.name FROM as400.production.users alias
  The modified SQL looks like:
    SELECT alias.name FROM as400.test.users alias
Up to now we used Crystal XI and developed using RDC. We solved the above described problem by reading the report SQL string, replacing the table location in this string and assigned it back to the report object. Modifying the SQL string has the advantage that it works fine also for reports which contain a SQL command.
Since Crystal Reports 2008 this is not possible anymore (no RDC, no direct way to modify the report SQL string).
My first approach was to use the CrystalDecisions.CrystalReports.Engine.Table object. First I just wanted to see what really was the content of the Location and Name property:
for (int i = 0; i < rdReport.Database.Tables.Count; ++i)
  Table rt = rdReport.Database.Tables<i>;
  Console.WriteLine("Table Nr : {0}", i);                   
  Console.WriteLine("  Table Loc  : {0}", rt.Location);
  Console.WriteLine("  Table Name : {0}", rt.Name);
My problem with this is that the output for the report with the SQL in the above example is:
Table Nr: 0
  Table Loc : users
  Table Name: alias
So obviously not the real table location and table name is returned, but instead the table name for the table location and the alias for the table name. Unsurprisingly setting the location had not the originally desired effect.
Furthermore if the report was designed using a SQL command, the location and in the name property contain the string COMMAND. Therefore the table object doesn't seems to be the solution to my problem.
Thanks to the help of a user in this forum here, I figured out how to read the SQL string of a report. Unfortunately I did not found a way to assign it back to the report.
Has anybody here an idea how to solve my problem? I'm open for every kind of hint.
Thanks in advance,
Ron

My solution looks like this:
ReportDocument rdReport = new ReportDocument();                   
rdReport.Load(sReportName, OpenReportMethod.OpenReportByTempCopy);
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rcDocument = rdReport.ReportClientDocument;                   
for (int i = 0; i < rdReport.Database.Tables.Count; ++i)
    CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctTable = rcDocument.DataDefController.Database.Tables<i>;
    if (rctTable.ClassName == "CrystalReports.CommandTable")
        Console.WriteLine("Processing CommandTable {0}",rctTable.Name);
        Console.WriteLine("  Old Qualified Name: {0}", rctTable.QualifiedName);
        Console.WriteLine("  Old Alias:          {0}\n" , rctTable.Alias);
        CrystalDecisions.ReportAppServer.DataDefModel.CommandTable tbOldCmd = (CrystalDecisions.ReportAppServer.DataDefModel.CommandTable) rctTable;
        CrystalDecisions.ReportAppServer.DataDefModel.CommandTable tbNewCmd = new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable();
        tbNewCmd.Name = tbOldCmd.Name;
        tbNewCmd.Alias = tbOldCmd.Alias;
        tbNewCmd.CommandText = sNewSql;
        tbNewCmd.ConnectionInfo = tbOldCmd.ConnectionInfo.Clone(true);
        CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbAttr = tbNewCmd.ConnectionInfo.Attributes;
        // set dlls
        pbAttr["Database DLL"] = "crdb_ado.dll";
        pbAttr["QE_DatabaseName"] = "NL67S021OUD";
        pbAttr["QE_DatabaseType"] = "OLE DB (ADO)";
        pbAttr["QE_ServerDescription"] = "192.0.5.24";
        pbAttr["QE_SQLDB"] = "True";
        pbAttr["SSO Enabled"] = "False";
        // set connection string                  
        CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbLogOnProp = (CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag)pbAttr[sAttrLogOnProp];
        pbLogOnProp.RemoveAll();
        // strangely comma seperated values instead of semicolon seperated values are needed here
        pbLogOnProp.FromString("Provider=IBMDA400,Data Source=" + sServerName + ",Initial Catalog=" + sDBName + ",User ID=" + sUserId + ",Password=" + sPwd + ",Convert Date Time To Char=TRUE,Catalog Library List=,Cursor Sensitivity=3");
        tbNewCmd.ConnectionInfo.UserName = sUserId;
        tbNewCmd.ConnectionInfo.Password = sPwd;
        rcDocument.DatabaseController.SetTableLocation(tbOldCmd, tbNewCmd);                           
    else
        Console.WriteLine("Processing Table {0}",rctTable.Name);                           
        Console.WriteLine("  Old Qualified Name: {0}", rctTable.QualifiedName);
        Console.WriteLine("  Old Alias:          {0}\n", rctTable.Alias);
        CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable rctNew = new CrystalDecisions.ReportAppServer.DataDefModel.Table();
        rctNew.Name = rctTable.Name;
        rctNew.Alias = rctTable.Alias;
        rctNew.QualifiedName = sDBName + ".V41TSTDBF.CRGUOPF";
        rctNew.ConnectionInfo = rctTable.ConnectionInfo.Clone(true);
        CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbAttr = rctNew.ConnectionInfo.Attributes;
        // set dlls
        pbAttr["Database DLL"] = "crdb_ado.dll";
        pbAttr["QE_DatabaseName"] = "NL67S021OUD";
        pbAttr["QE_DatabaseType"] = "OLE DB (ADO)";
        pbAttr["QE_ServerDescription"] = "192.0.5.24";
        pbAttr["QE_SQLDB"] = "True";
        pbAttr["SSO Enabled"] = "False";
        // set connection string                  
        CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pbLogOnProp = (CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag) pbAttr[sAttrLogOnProp];
        pbLogOnProp.RemoveAll();
        // strangely comma seperated values instead of semicolon seperated values are needed here
        pbLogOnProp.FromString("Provider=IBMDA400,Data Source=" + sServerName + ",Initial Catalog=" + sDBName + ",User ID=" + sUserId + ",Password=" + sPwd + ",Convert Date Time To Char=TRUE,Catalog Library List=,Cursor Sensitivity=3");
        rctNew.ConnectionInfo.UserName = sUserId;
        rctNew.ConnectionInfo.Password = sPwd;                         
        rcDocument.DatabaseController.SetTableLocation(rctTable, rctNew);
        Console.WriteLine("  New Qualified Name: {0}", rctTable.QualifiedName);
        Console.WriteLine("  New Alias:          {0}\n", rctTable.Alias);
Console.WriteLine("\nSetting parameter {0} to value {1}", rdReport.ParameterFields[0].Name, iDataId);
rdReport.SetParameterValue(0, iDataId);
Console.WriteLine("\nShow SQL: ");
CrystalDecisions.ReportAppServer.Controllers.RowsetController rsController;
CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument rdClient = rdReport.ReportClientDocument;
CrystalDecisions.ReportAppServer.DataDefModel.ISCRGroupPath rdGroupPath = new CrystalDecisions.ReportAppServer.DataDefModel.GroupPath();
string temp;
string sql;
rsController = rdClient.RowsetController;
sql = rsController.GetSQLStatement(rdGroupPath, out temp);
Console.WriteLine(sql);
Console.WriteLine("Printing");
PageMargins pmMargins = rdReport.PrintOptions.PageMargins;
pmMargins.bottomMargin = 350;
pmMargins.leftMargin = 350;
pmMargins.rightMargin = 350;
pmMargins.topMargin = 350;
rdReport.PrintOptions.ApplyPageMargins(pmMargins);
rdReport.PrintOptions.PrinterName = sPrinterName;
rdReport.PrintToPrinter(1,     // copies
                        false, // collated
                        0,     // start page
                        0);   // end page
rdReport.Close();
Regards,
Ron

Similar Messages

  • Crystal Reports 2008 - ERROR when changing datasource

    Hi, I have a report that is connected to a test database that needs to have the datasource changed to the production database.
    The Crystal Report has 2 "on-demand" subreports that the datasource has been changed for as well.
    SQL 2000 Databases on 2 different servers (W2003) used the "Set Datasource Location" and followed steps listed previously in the forum.
    Databases have different names but all tables are same in both.
    Database Expert is showing all tables coming from new datasource BUT when report is run parameter prompt comes up, click ok
    Error message - "Failed to retrieve data from the database" - click OK
    Error message - "Invalid Argument provided"
    Does anyone have an ideas on how to track down the issues.
    Please let me know if you need any other information

    Ok answers below:-
    1. Crystal Reports 2008 Cersion 12.1.0.892
    2. Connecting via OLEDB
    3. Yes able to refresh newly created report without sub reports enclosed
    4. Didn't know that this could be done - this report was done for us by a consultant who doesn't know how to fix this issue and reckons there is a bug in Crystal
    5. Sub reports are accessed after main report is run (I think that means that they are linked)
    6. Not sure how to do this as am newbie to Crystal Reports and we are relying on the person that we contracted to write the reports to know what he is doing.
    Any help appreciated I will try to go into the sub report and unlink - think I have found out how to do this.
    Thanks for the help so far!!

  • Crystal Reports 2008 - Error setting new datasource location

    Hi All,
    We are experiencing an issue while trying to set datasource location for our RM 3.0 reports in Crystal Reports 2008 designer. As per guide "SAP BusinessObjects Process Control 3.0 and Risk Management 3.0 - How to build and Personalize Custom Crystal Reports" (step 11), after opening the desire report we go to DataBase-->Set DataSource Location and when selecting our RM system (which actually has the BI content addon installed on it), we got the following error message:
    "Some tables could not be replaced, as no match was found in the new data source. Please verify the table required for any unmodified tables"
    I'm new on this so I'm not sure if the table indicated in the original datasource should exist in my DB (new datasource) before doing this? If so, how those tables are imported or created in our DB?
    Could you please help me on this issue?
    Please let me know if any other detail or data is required.
    Regards

    Hi Don,
    Thanks for the update.
    Actually I've installed SAP Integration Kit and its Fixpack in both....BOE Server (which is the same as the SAP server) and in client pc.  In all cases we have select a typical installation which supposes the required drivers are available. Also I've followed Ingo's documentation to activate and publish standard Risk Management reports (RM reports). Everything works ok with them. We are able to access reports through the application.
    The issue appears when trying to customize one of these standard reports through CR Designer. For example if we select the "GRRM_Risk_by_Risk_Category" and try to customize it as indicated in the "SAP BusinessObjects Process Control 3.0 and Risk Management 3.0 - How to build and Personalize Custom Crystal Reports"...the table behind this report (table GRFN_CY_API_GRRM_R1) it's not in our RM System. My main concern or question is regarding this....Did I miss something while importing transports files, activating or publishing RM reports, etc....and thatu2019s the reason why this (and any other) table is not already in my system? I was not able to find where those tables are supposed to be or how they should be imported in my system. The odd thing is...that we are trying to customize and set the new data source for these reports to the same system from where they are being opened. Put in this way...RM reports have been activated in system A (RM System) and published to system B (BOE System). While customizing reports through CR Designer...we are actually opening reports from system A. These reports have as their original data source...a demo SAP system info (uxcir1p.wdf.sap.corp) and when we want to update this data source with our RM system....the error appears. The whole process is explained in the above mentioned guide for your reference.
    Hope being clear enough..
    Thanks for your help

  • Not able to get the tables in crystal report 2008

    Hi,
    I am using crystal report 2008 and trying to connect MS SQL using OLE DB (ADO) connection. After giving all DB credentials data base tables are not appearing in the connection. how to get the tables for selection in crystal report 2008.
    Regards,
    Sree

    In the CR Designer, select the connection and press the right mouse button. Select Options in the context menu and check if there is an entry in the Table name fiel. Maybe you have a placeholder there that does not match the names of the tables in the database. Just remove it, close the window by pressing OK and refresh the connection browser (press F5). Unfold the connection again and check if you can see the tables now.
    Regards,
    Stratos

  • How to change the name of a Box Object in Crystal Reports 2008

    I am trying to change the name of a box object in a crystal report - 2008. This report was originally developed by consultants and requires that certain boxes be named according to a specific naming convention. I am making a change to the report and need to add a box with a name that matches the naming convention.  This is so some program functionality will work for the new box.  I can't contact the consultants because they don't work with our company anymore.
    Does anybody have any ideas? I've tried 'Format Box', but it won't let me change the name from there. I also tried it in the Report Explorer but to no avail.
    Thanks,
    Joanne

    Hi Joanne,
    Boxes do not actually have a 'name'. When you add a Box in a report, it will be called 'Box 1' by default. And the only place this name is visible is under the Report Explorer.
    Or do you mean to say 'Text Object'?
    -Abhilash

  • Crystal Reports 2008; Can't select the certain table. Why?

    Please help me everyone!
    problem note:
    I'm using Crystal Report 2008 to access MS SQL Server 2005 Database.
    Everything was good until last month.
    But somehow when I select the table "FTABLE11C", Crystal Repors hanging-up and no more Crystal Reports works.
    If I copy the FTRAN11C to different name such as "aaa" using following statement and use Crystal Reports then I can select the "aaa" whthout problems.
    Select * into aaa from FTRAN11C.
    So, I drop the tbale FTRAN11C and copy FTRAN11C from aaa table using following statement,
    select * into FTRAN11C from aaa
    and select the FTRAN11C again on Crystal Reports 2008, Crystal Reports 2008 hanging-up again.
    I'd like to know how to solve this situation.
    Thanks.
    1. We didn't have any patch on SQL Server.
    2. I delete one field on table that named "FTRAN11C".
       That's all.
    3. I tried following steps;
       a. Copy the file to another name.
            Select * into aaa from FTRAN11C
       b. Droped the bad table.
            Drop table FTRAN11C
       c. Copy back from saved table.
            Select * into FTRAN11C from aaa
    4. Open Crystal Reports 2008
       a. Connect to database with OLD DB.
           Crystal Reports shows all the tables within database without any problems.
       b. Select the table aaa.
           No problems. It shows on right side box.
       c. Select the table FTRAN11C that is recently created from saved table.
           Now we have problems.
            It does not shows on right side box.
            Little circle displaying forever.
            If I click right side x, Crystal Reports 2008 is closed.
    5. If I use following command on SQL Server Management Studio Express, all of data shows without any problems.
           Select * from FTRAN11C

    Install all patches as you are on the original release:
    Be sure you have the keycode, used to install the product, I will not be able to get you a new one if you lose it or don't have it available.
    The easiest way to update is to uninstall CR 2008 and then install Service Pack 3 full build:
    https://smpdl.sap-ag.de/~sapidp/012002523100009989492010E/cr2008_sp3_fullbuild.zip
    Then install SP 4:
    https://smpdl.sap-ag.de/~sapidp/012002523100008782452011E/cr2008sp4.exe
    Then test your reports again.
    As for using/upgrading to CR 2011 it's not required and likely won't make any difference but you can upgrade if you want of course.
    Don

  • Crystal Reports 2008 crashes when previewing image with graphic location

    Hi,
    I'm using Crystal Reports 2008 for SAP Business One.  When I try to insert an image with a UNC graphic location (browse to a UNC drive for image) and I preview, Crystal Reports crashes with the following debug info:
    Problem signature:
      Problem Event Name:     APPCRASH
      Application Name:     crw32.exe
      Application Version:     12.1.0.892
      Application Timestamp:     48de4bbc
      Fault Module Name:     cslibu-3-0.dll
      Fault Module Version:     12.4.0.966
      Fault Module Timestamp:     4daed0a1
      Exception Code:     c0000094
      Exception Offset:     0002d7fd
      OS Version:     6.1.7601.2.1.0.272.7
      Locale ID:     1033
      Additional Information 1:     0a9e
      Additional Information 2:     0a9e372d3b4ad19135b953a78882e789
      Additional Information 3:     0a9e
      Additional Information 4:     0a9e372d3b4ad19135b953a78882e789
    Any idea why?  If I trun graphic location off, it works fine.
    The code I'm using to pull image is:
    sapserver\B1_SHR\Bitmaps\Versailles\" & {RSM_Inventory_Images;1.PicturName}
    Thanks.

    Through  Startu2014Run are you able to view the image by choosing the following path ?
    sapserver\B1_SHR\Bitmaps\Versailles\" & {RSM_Inventory_Images;1.PicturName}
    Also try to insert any image which is on your local hard drive and try.  I think this is because, CR is unable to access the images which are on UNC.
    Thanks,
    Sastry

  • Some reports do not work after upgraded to Crystal Report 2008

    Hi All,
    After upgraed from Crystal Report XI to Crystal Report 2008, some reports work fine. others not. All of the not-working reports have the same problem: Database connection failed.
    And I can even not be able to create a brand new report. The problem looks like following:
        1. Created a new ASP.NET solution in Visual Studio 2008. The page file is default.aspx
        2. Created an empty Crystal Report file: CrystalReportTEST.rpt
        3. Asign CrystalReportTEST.rpt to default.aspx
        4. Run default.aspx. It works fine
        5. Just connect to database without place any field to the report
        6. Run default.aspx again. It does not work. It shows blank screen with the message "Database logon failed." on the top-left corner.
    Regards,
    Triple

    Hi Amit,
    I have tested many times again for creating new report in new solution. It looks like that, the preview in VS2008 always work fine, but when runing the application, sometimes it works sometimes does not work. I have not still found the role. Following step shows my testing process:
    1. Start Visual Studio 2008
    2. Go to menu "File->New->Web Site..."
    3. In dialogbox "New Web Site"
              a. Highlight "ASP.NET Crystal Reports Web Site"
              b. Select location "File System"
              c. Select language "Visual C#"
              d. Select "E:\JL\CrystalReportsWebSite1"
              e. Click button "OK"
    4. It appears dialogbox "Crystal Reports Gallery"
              a. Select "Using the Report Wizard" in portion of "Create a New Crystal Report Document"
              b. Select "Standard" in portion of "Choose an Expert"
              c. Click button "OK"
    5. It appears dialogbox "Standard Report Creation Wizard"
              a. Click button "Cancel"
    6. It is back to page edit view of "CrystalReport1.rpt"
    7. Click button "Main Report Preview". It shows the preview with blank page
    8. Click button "Main Report". It came back to the edit view
    9. Go to menu "Crystal Reports -> Database -> Database Expert...", dialogbox "Database Expert" appears. Select table u201Cactivity_cdu201D as showing in following screen shot:
    10. Click button u201COKu201D. It returns to the edit view without any changes
    11. Place some fields into the report, then click button "Main Report Preview". It shows the preview with data
    12. Run application by pressing key F5 or key combinition Ctrl+F5, it shows up database connection import screen
    13. Close the browser and back to file Default.aspx, change u201CEnableDatabaseLogonPromptu201D to u201DFalseu201D and run the application again, it shows following message "Database logon failed."
    Regards,
    Triple

  • Database Logon Failed which created by Crystal Report 2008

    this time i meet the famous error again which is database logon failed.
    i created a crystal report 2008 starting from blank report, then connect with odbc
    i use 2008 method
    objRpt.SetDatabaseLogon(db_username, db_password, odbc_name, database_name);
    2008 method will get database logon failed even set database location and verify database again
    then i use 8.5 method and try again for 2008 report. it said field name is unknown for one of formula
    then i drag field again for formula and set database location and verify database again
    it said the same error.
    then i uninstall 8.5 crytal report software in window 7 deployment machine, and do above again, it said the same error
    //'Create a new Stored Procedure Table to replace the reports current table.
            CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable = new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
            //'boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
            PropertyBag boMainPropertyBag = new PropertyBag();
            //'boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
            //'In the main property bag (boMainPropertyBag)
            PropertyBag boInnerPropertyBag = new PropertyBag();
            //'Set the attributes for the boInnerPropertyBag
            boInnerPropertyBag.Add("Connect Timeout", "15");
            //boInnerPropertyBag.Add("Data Source", "MyDataSource");
            boInnerPropertyBag.Add("Data Source", "10.1.1.191");
            boInnerPropertyBag.Add("DataTypeCompatibility", "0");
            boInnerPropertyBag.Add("General Timeout", "0");
            //boInnerPropertyBag.Add("Initial Catalog", "MyCatalog");
            boInnerPropertyBag.Add("Initial Catalog", database_name);
            boInnerPropertyBag.Add("Integrated Security", "False");
            boInnerPropertyBag.Add("Locale Identifier", "1033");
            boInnerPropertyBag.Add("MARS Connection", "0");
            //boInnerPropertyBag.Add("OLE DB Services", "-5");
            //boInnerPropertyBag.Add("ODBC", "-5");
            boInnerPropertyBag.Add("ODBC", "Cheque");
            boInnerPropertyBag.Add("Provider", "SQLNCLI");
            boInnerPropertyBag.Add("Tag with column collation when possible", "0");
            boInnerPropertyBag.Add("Trust Server Certificate", "0");
            boInnerPropertyBag.Add("Use Encryption for Data", "0");
            //'Set the attributes for the boMainPropertyBag
            boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
            //boMainPropertyBag.Add("Database DLL", "p2sodbc.dll");
            //boMainPropertyBag.Add("QE_DatabaseName", "VEPILOT");
            boMainPropertyBag.Add("QE_DatabaseName", database_name);
            //boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
            boMainPropertyBag.Add("QE_DatabaseType", "ODBC");
            //'Add the QE_LogonProperties we set in the boInnerPropertyBag Object
            boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
            boMainPropertyBag.Add("QE_ServerDescription", "MyServer");
            boMainPropertyBag.Add("QE_SQLDB", "True");
            boMainPropertyBag.Add("SSO Enabled", "False");
            //'Create a new ConnectionInfo object
            CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
            //'Pass the database properties to a connection info object
            boConnectionInfo.Attributes = boMainPropertyBag;
            //'Set the connection kind
            boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
            //'*EDIT* Set the User Name and Password if required.
            boConnectionInfo.UserName = db_username;
            boConnectionInfo.Password = db_password;
            //'Pass the connection information to the table
            boTable.ConnectionInfo = boConnectionInfo;
    CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables = objRpt.ReportClientDocument.DatabaseController.Database.Tables;
                CrystalDecisions.CrystalReports.Engine.Tables tables = objRpt.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
                    if (!string.IsNullOrEmpty(table.Name))
                        //boTable.Name = table.Name;
                        //boTable.QualifiedName = database_name + ".dbo." + table.Name;
                        //boTable.Alias = table.Name;
                        boTable.Name = "sp_ChequeIssueDetRpt";
                        boTable.QualifiedName = database_name + ".dbo.sp_ChequeIssueDetRpt";
                        boTable.Alias = "sp_ChequeIssueDetRpt";
                        objRpt.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
                objRpt.VerifyDatabase();
    http://sourceforge.net/projects/aspchequesprint/files/ChequeIssueDet.rpt/download

    No subreport, only a stored procedure with final two lines are
    print @m_sql
    exec (@m_sql)
    After use generated code in the link above
    Error at boReportDocument.VerifyDatabase();
    Inner Exception : no error
    Message "Logon failed"
    ErrorID : CrystalDecisions.CrystalReports.Engine.EngineExceptionErrorID.LogOnFailed
    HelpLink : null
    stacktrace :  CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()\r\n   at viewReport.Page_Load(Object sender, EventArgs e) 於 d:
    Data
    My Documents
    Visual Studio 2008
    WebSites
    Cheques
    viewReport.aspx.cs: row 1302\r\n   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n   at System.Web.UI.Control.OnLoad(EventArgs e)\r\n   at System.Web.UI.Control.LoadRecursive()\r\n   於 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    TargetSite : {Void VerifyDatabase()}
    string reportPath = report_path + "ChequeIssueDet.rpt";
                boReportDocument = new ReportDocument();
                //**EDIT** Change the path and report name to the report you want to change.
                boReportDocument.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
                //Create a new Stored Procedure Table to replace the reports current table.
                CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable =
                new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
                //boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
                PropertyBag boMainPropertyBag = new PropertyBag();
                //boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
                //In the main property bag (boMainPropertyBag)
                PropertyBag boInnerPropertyBag = new PropertyBag();
                //Set the attributes for the boInnerPropertyBag
                boInnerPropertyBag.Add("Database", database_name);
                boInnerPropertyBag.Add("DSN", "Cheque");
                boInnerPropertyBag.Add("UseDSNProperties", "False");
                //Set the attributes for the boMainPropertyBag
                boMainPropertyBag.Add("Database DLL", "crdb_odbc.dll");
                boMainPropertyBag.Add("QE_DatabaseName", database_name);
                boMainPropertyBag.Add("QE_DatabaseType", "ODBC (RDO)");
                //Add the QE_LogonProperties we set in the boInnerPropertyBag Object
                boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
                boMainPropertyBag.Add("QE_ServerDescription", "Cheque");
                boMainPropertyBag.Add("QE_SQLDB", "True");
                boMainPropertyBag.Add("SSO Enabled", "False");
                //Create a new ConnectionInfo object
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
                new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
                //Pass the database properties to a connection info object
                boConnectionInfo.Attributes = boMainPropertyBag;
                //Set the connection kind
                boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
                //**EDIT** Set the User Name and Password if required.
                boConnectionInfo.UserName = db_username;
                boConnectionInfo.Password = db_password;
                //Pass the connection information to the table
                boTable.ConnectionInfo = boConnectionInfo;
                //Get the Database Tables Collection for your report
                CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
                boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
                //For each table in the report:
                // - Set the Table Name properties.
                // - Set the table location in the report to use the new modified table
                boTable.Name = "sp_ChequeIssueDetRpt;1";
                boTable.QualifiedName = database_name+".dbo.sp_ChequeIssueDetRpt;1";
                boTable.Alias = "sp_ChequeIssueDetRpt;1";
                boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
                //Verify the database after adding substituting the new table.
                //To ensure that the table updates properly when adding Command tables or Stored Procedures.
                boReportDocument.VerifyDatabase();
                //**EDIT** Set the value for the Stored Procedure parameters.
                string m_curUser = "";
                int spid = Convert.ToInt32(Request.Cookies["login_cookie"]["spid"]);
                queryString = "select * from v_All_Session where SPID=" + spid.ToString();
                //string _connectionString = ConfigurationManager.ConnectionStrings["ChequeConnectionString"].ConnectionString;
                using (SqlConnection connection = new SqlConnection(_connectionString))
                    SqlCommand command = connection.CreateCommand();
                    command.CommandText = queryString;
                    connection.Open();
                    using (SqlDataReader datareader = command.ExecuteReader())
                        if (datareader.HasRows == true)
                            while (datareader.Read())
                                if (datareader["UserID"] != System.DBNull.Value)
                                    m_curUser = datareader["UserID"].ToString();
                        datareader.Close();
                    connection.Close();
                boReportDocument.SetParameterValue("@UserID", m_curUser);
                if (string.IsNullOrEmpty(Session["fm_CoCode"].ToString()))
                    boReportDocument.SetParameterValue("@fm_CoCode", Session["fm_CoCode"].ToString());
                if (string.IsNullOrEmpty(Session["to_CoCode"].ToString()))
                    boReportDocument.SetParameterValue("@to_CoCode", Session["to_CoCode"].ToString());
                if (string.IsNullOrEmpty(Session["fm_BankACNo"].ToString()))
                    boReportDocument.SetParameterValue("@fm_BankACNo", Session["fm_BankACNo"].ToString());
                if (string.IsNullOrEmpty(Session["to_BankACNo"].ToString()))
                    boReportDocument.SetParameterValue("@to_BankACNo", Session["to_BankACNo"].ToString());
                if (string.IsNullOrEmpty(Session["fm_BatchNo"].ToString()))
                    boReportDocument.SetParameterValue("@fm_BatchNo", Session["fm_BatchNo"].ToString());
                if (string.IsNullOrEmpty(Session["to_BatchNo"].ToString()))
                    boReportDocument.SetParameterValue("@to_BatchNo", Session["to_BatchNo"].ToString());
    Edited by: Mathew_666 on Jul 19, 2011 4:27 AM
    Edited by: Mathew_666 on Jul 19, 2011 4:28 AM

  • Crystal Reports 2008, mySQL, JDBC, and ODBC

    Hello everyone.
    I have just spent a very challenging few days getting Crystal Reports 2008 Developer (advanced version) working with a mySQL data source.  I fell into several pits and narrowly escaped being eaten by monsters. I thought I'd share my experience to spare others the same trouble.  All the stuff I'm writing about here applies to the runtime as well as the Developer UI.
    I'm working on Windows Server 2008 R2, 64 bit, standard edition.  The mySQL server is 5.1.42. The mySQL ODBC connector is version 5.1.6.  You need the 32-bit version of this connector, even if you're on a 64-bit machine.
    Lessons learned:
    1. JDBC connectivity in Crystal Reports doesn't work correctly.  It consumes excessive memory when a report  requires lots of rows from a data base.  Don't even think about using it.
    2. Crystal Reports has a problem with ODBC for mySQL in which it sometimes gives a dialog box with these words in it.
    The alias requested 'SOME_TABLE_NAME', contains a combination
       of characters which is not considered to be valid.
    This error message come up when using items on Crystal's "Database" menu like "Set Datasource Location..."
    To fix this you need to make a registry change.  As far as I know this has to be done for each account on each machine running the Crystal Developer. (insert usual warning about registry editor). Find the key named:
    [HKEY_CURRENT_USER\Software\Business Objects\Suite 12.0\Crystal Reports\Database
    Create a new string value named InvalidAliasCharList Give it this value:
    .:{}()@&$#^!*~|%\\\"
    Notice that the last two characters are backslash double-quote.
    Good luck.  It actually works pretty well now that it's working.
    If any other community member can offer corrections or better ways of coping with this stuff, please do!

    Good morning,
    I was wondering if I may ask some additional help...
    We're on version 14.0.4.738 RTM and we are having the same issue.... need to enter the alias as table name with a backslash, ie serparate_work_orders\ for login credential reasons, but all the regedits listed seem to refer to locations in the registry that dont exist.
    Version 14 have two "database locations" from what i can see called...
    HKEY_CURRENT_USER\Software\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\DatabaseOptions
    and
    HKEY_CURRENT_USER\Software\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\DatabaseServer
    I've applied the patch to both these locations and still no joy, same error message!
    Any ideas?

  • Dynamic Sorting on Multiple filed in Crystal report 2008

    Hi
      I am using Crystal report 2008 sp3 full build with hotfix 3.3 along with ASP.NET 2.0
      I have implimented the multi filed sorting using the record sort export and setting the sort order in the report designer.
    Now my requirement is such that i would like to have dynamic sorting on multiple fileds while report is displayed in the UI.
    Means suppose i have a report with Customer region,name,city,rating,status etc.
    Now by using the sort control  i would like to have the functionality in such a way that if user
    a)  first sorts on the region then the records should be first sorted by region
    b)  then sorts on the city then the records should be sorted first by region then by city
    c) now sorts on the  rating then the records should be sorted first by region ,second by city and then by rating
    Now other user may do
    a) first sorts on the rating then the records should be first sorted by rating
    b)  then sorts on the status then the records should be sorted first by rating then by status
    c) now user sorts on the  region then the records should be sorted first by rating,second by status and then by region
    and so on the sorting criteria changes from user to user through the UI.
    Is there any way to achieve the dynamic kind of sorting with Crytsal report 2008 where we can set the order of the fileds at sorting in UI dynamically .The sorting order of the fields are not known at the time of design of the report and its completely depends on the user's need.
    Please let me know if you require any information on the same.
    Regards,
    smitha

    Hello,
       Good Day!
       Thanks for your answer.
       Could you please explain me in detail how to achieve this functionality?
       Do i need to create a static parameter?
       I  get my data set through the command option in crystal report.So i think i need to go by formula in the report.
       i am just putting down the steps to follow.Please correct me if i am wrong.
      step1 :Create s static parameter with the name SORT.
    step2: create the formula as you have mentioned like     
        (IF {?Sort}='Vendor Number' THEN {Pr_Voucher_Status;1.Vendor_Key}& " "& {Pr_Voucher_Status;1.ap_remt_key}
        & " " & {@date}
       else
        IF {?Sort}='Invoice Number' THEN {Pr_Voucher_Status;1.ap_vchr_invno}& " " & {Pr_Voucher_Status;1.Vendor_Key}&
        " " &{@date}
       else
       IF {?Sort}='Invoice Amount' THEN {Pr_Voucher_Status;1.ap_vchr_amtc}& " " & {Pr_Voucher_Status;1.Vendor_Key}&
         " " &{@date})
        I could not  understand what this formula is really doing .
        Could you please tell me what the following names indicates? :
                  Pr_Voucher_Status :- Table/Command name ??
                  Vendor Number,Invoice Number etc.. :-  ??
                 Vendor_Key,ap_vchr_invno,ap_vchr_amtc .. :-  Filed names ??
                 use of 1.{} :- ??                              
    step3: place the below formula in the page header  to display the sort order
        (if {?SORT}='Vendor Number' then "Vendor Number, Remit To, Invoice Date"
              else if {?SORT}='Invoice Number' then "Invoice Number, Vendor Number, Invoice Date"
              else if {?SORT}='Invoice Amount' then "Invoice Amount, Vendor Number, Invoice Date") .
    Note:-My report does not have grouping.Do i need to have grouping?
    in this case how the sort control will work  ?
    As i have mentioned in the first post the order of sorting is completely depends on the user's perspective .
    The report is used by the whole organization ..
    i mean the people with different roles like Manger,Team leads,modul leads,developers ,testers etc..
    the usage of report varies according to the roles so the sort order also.
    Regards,
    smitha.
    Edited by: smitha thomas on Mar 16, 2011 5:01 AM

  • Crystal Reports 2008-Vista-ERROR-crw32.exe Entry Point Not Found in dll

    Hi Experts,
    I just installed the Crystal Reports 2008 (with SP0) on my Vista (Home) machine.  When I try to start the CR 2008, I am getting the below error message:
    Error Title: crw32.exe - Entry Point Not Found
    Error Message: The procedure entry point ?PrintLegend@CMapXLegend@CSLib300@@QAEXJJJJJ@Z could not be located in the dynamic link library cslibu-3-0.dll
    Here are the things I tried to resolve the above problem:
    1) Uninstall and Reinstall the CR 2008.  -  No change.
    2) I configured the DEP to accept Crystal Reports (Performance - Advanced - DEP allow). 
    None of these seem fix the problem. 
    Can you please help me kick start the Crystal Reports 2008? 
    Thanks,
    Arun

    Please try with this:
    Run a command prompt as administrator. From the start menu, select "All Programs", then "Accessories" and right-click on the "Command Prompt" shortcut and choose "Run As Administrator". From here you can use the following command to disable Data Execution Prevention (DEP) with the following command:
    bcdedit.exe /set nx AlwaysOff
    Keeping your command prompt open, run your setup or other process being stopped by DEP. Then, to turn it back on again, do the same and run the following:
    bcdedit.exe /set nx AlwaysOn
    Regards,
    Shweta

  • Crystal Report 2008 File Open limit

    In Crystal Reports 2008 when selecting File > Open > Enterprise  The number of files listed in each directory looks to be limited to around 25 files.
    If I have a directory with more then that number of files, I have to move the file to another folder or rename it (using CMC) so it shows up in the first bunch of files if I want to open it.
    Is there a way to increase the number of files shown in the Enterprise window?
    Thanks

    Hello,
    Not exactly clear what you want? Save your reports to your D drive would be my first guess.... If you are referring to the \temp folder then change your system Environment Variable from the default to d:\temp and also change the TMP to d:\Tmp.
    You could even set your Swap file to d drive also. I suggest you contact your IT department or search Microsoft's site on how to optimize hard drive space when it's limited. PLEASE back up everything first before making changes to your swap file location, if you don't do it right you may not be able to start windows.
    Thank you
    Don

  • Crystal Reports 2008 and Dynamic Images

    Hello,
    I have a windows .net application that uses a listing of items in a grid.  The user selects an item then clicks the print button and that brings up a report viewer form and passes the photograph location in a parameter to the report document being loaded.
    The first time that this report is printed, the image for the selected item is printed correctly.  The next time the report is printed, the default image used to create the graphic object on the report is printed.
    In addition if a user double clicks on the listing of items, a detail form is displayed.  When the same report is printed from this screen, the default image used to create the graphic object on the report is printed.
    This is happening in multiple .net windows applications.
    Can anyone please give me an idea as to what may be causing this.
    I am using Crystal Reports 2008 with Service Pack 2 installed.
    Thanks

    The following is the code in the Report Viewer form that contains the Crystal Report Viewer Control.
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.Windows.Forms
    Imports System.IO
    Public Class RptViewer
        Inherits System.Windows.Forms.Form
        Dim MyReport As CrystalDecisions.CrystalReports.Engine.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
        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
        Friend WithEvents CrystalReportViewer1 As CrystalDecisions.Windows.Forms.CrystalReportViewer
        '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.
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(RptViewer))
            Me.CrystalReportViewer1 = New CrystalDecisions.Windows.Forms.CrystalReportViewer
            Me.SuspendLayout()
            'CrystalReportViewer1
            Me.CrystalReportViewer1.ActiveViewIndex = -1
            Me.CrystalReportViewer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
            Me.CrystalReportViewer1.Dock = System.Windows.Forms.DockStyle.Fill
            Me.CrystalReportViewer1.Location = New System.Drawing.Point(0, 0)
            Me.CrystalReportViewer1.Name = "CrystalReportViewer1"
            Me.CrystalReportViewer1.Size = New System.Drawing.Size(656, 481)
            Me.CrystalReportViewer1.TabIndex = 0
            Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None
            'RptViewer
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(656, 481)
            Me.Controls.Add(Me.CrystalReportViewer1)
            Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
            Me.Name = "RptViewer"
            Me.Text = "Report Viewer"
            Me.WindowState = System.Windows.Forms.FormWindowState.Maximized
            Me.ResumeLayout(False)
        End Sub
    #End Region
        Private Sub RptViewer_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
                myConnectionInfo.ServerName = MyServer (Name of SQL Server)
                myConnectionInfo.DatabaseName = MySqlDb (Name of Database)
                myConnectionInfo.UserID = MyUid (Userid for SQL Database)
                myConnectionInfo.Password = MyPwd (Password for SQL Database)
                MyReport = New CrystalDecisions.CrystalReports.Engine.ReportDocument
                MyReport.Load(Path.GetFullPath(".") & "\" & MyReportFile)
                MyReport.SummaryInfo.ReportTitle = MyReportTitle  (Title passed to the report)
                MyReport.SummaryInfo.ReportComments = MyReportComments   (Comments passed to the report)
                SetDBLogonForReport(myConnectionInfo, MyReport)
              MyReport.SetParameterValue("MySequence", MyReportKey)  (Parameter passed to select single record in table)
               MyReport.SetParameterValue("MyPhotoLocation", sPhotoLocation)  (Physical Location of Photograph \\Server\Photos\)
                CrystalReportViewer1.ReportSource = MyReport
                'handle any exceptions
            Catch ex As Exception
                MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK)
            End Try
        End Sub
        Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo, ByVal myReportDocument As ReportDocument)
            Dim myTables As Tables = myReportDocument.Database.Tables
            Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
            For Each myTable In myTables
                Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo
                myTableLogonInfo.ConnectionInfo = myConnectionInfo
                myTable.ApplyLogOnInfo(myTableLogonInfo)
            Next
        End Sub
    End Class
    In the Crystal Report the Graphic Location formula field takes the {?MyPhotoLocation} + {Table.Photo} field to display the picture.  I have placed the parameter and the photo field on the report and the correct data is in the fields.
    This is the exact same form being opened and that displays correctly from the listing screen.
    Joel
    Edited by: JYaeger on Aug 8, 2009 2:56 AM

  • Crystal Reports 2008 parameter panel discrepancy.

    Hi,
    I have a report designed using Crystal Reports 2008. The report has a dynamic parameter called Location which is populated from a table. It is a Value - Description pair so it is:
    Value = LocID
    Descripition = LocationName.
    The Show on Viewer(Panel) attribute is set to Editable.
    The Prompt with Description Only attribute is set to true.
    In the Crystal Reports stand-alone Designer everything works fine. It prompts with the Description. After making a selection, the Parameter Panel shows the selected items(the Description, NOT the value) correctly. This is the desired behavior.
    But  when the report is viewed in the Crystal Reports Viewer that comes with .NET 2008 the Parameter panel shows the Value, which is LocID and not the description which is LocationName. This is NOT very useful.
    I have tried other third party Crystal Reports viewers as well. They all exhbit the same discrepancy.
    How can this be resolved?
    Any help is greatly appreciated.
    Thanks in advance.
    - Rajan.

    Hi Don,
    Thank you for your response. The assemblies and their versions are as follows;
    CrystalDecisions.CrystalReports.Engine - 12.0.2000.0
    CrystalDecisions.Enterprise.Framework - 12.0.1100.0
    CrystalDecisions.Shared                         - 12.0.2000.0
    CrystalDecisions.Windows.Forms          - 12.0.2000.0
    Thanks,
    - Rajan.

Maybe you are looking for

  • Mass change of po message error

    Dear Experts. I am trying to change the WBS in purchase orders.(BUS2012). However when i execute the system gives me that no data has changed. the system shows that no data has changed as below. Kindly assist. Thanks. Carol.

  • HT4847 iPhone Capacity Question concerning iCloud Storage

    Does buying additional icloud storage allow me to download more music on my iPhone?  I purchased additional storage, but I can't sync due to being over capcity (16 gb).

  • BW configuaration documents

    Hi...I am new to BW..Can any one of you please send me the detailed configuartion documents for R/3 and BW side. Like how exactly we should start a  project from intial stage configuaration in R/3 side and BW side..Please send me some kind of PPT / s

  • Content Aggregation

    Hi, I am now studying and analyzing the Bea WebLogic Portal. I want to know is there any engine similar to personalization engine , which will manage the aggregation of contents from various portals. I am elaborating it further now, In a portal page

  • Help-urgent - how to update service pack and apply patches for ADS

    Dear all,    I've just download the sp 11 and the patch ,how should i update my ADS? I've try to search the forum but to no avail. Pls advise,thanks. Regards, Joan