Crystal Reports - Switch between multiple databases at runtime (esp. DB2)

Hi,
we are currently developing a reporting application in .NET (C#) with an integrated Crystal Viewer. We want to be able to change the databse dynamically at runtime, especially between different DBMS.
We encountered no problems when switching between a SQL Server and an Oracle DB, but we ran into big trouble if trying to connect to a DB2 db.
In the report itself we have a SQL Server connection defined that is used during the design phase.
In our application we change the connection at runtime using the following code:
CrystalReportViewer viewer = new CrystalReportViewer();
ReportDocument document = new ReportDocument();
document.Load("<<path>>");
Tables tables = document.Database.Tables;
foreach (Table t in tables)
    ConnectionInfo info = new ConnectionInfo();
    info.UserID = "<UserId>";
    info.Password = "<Password>";
    info.ServerName = "<DSN of DB2 DB>";
    info.DatabaseName = "<DB2 DB Alias>";
    TableLogOnInfo tableInfo = t.LogOnInfo;
    tableInfo.ConnectionInfo = info;
    t.ApplyLogOnInfo(tableInfo);
// ... Setting parameter values ...
viewer.ReportSource = document;
We also tried to add the following lines of code after the "ApplyLogOnInfo" call without any success:
t.LogOnInfo.ConnectionInfo.UserID = "<UserId>";
t.LogOnInfo.ConnectionInfo.Password = "<Password>";
t.LogOnInfo.ConnectionInfo.ServerName = "<DSN of DB2 DB>";
t.LogOnInfo.ConnectionInfo.DatabaseName = "<DB2 DB Alias>";
Especially we are wondering because we don't get any error message. The Crystal Viewer just opens and shows an empty report without any data records. The TestConnectivity method called on each table (we are only using one table at the moment) also returns true.
Furthermore it seems that whenever we call ApplyLogOnInfo, the UserID, password, server name and database name is resetted to the values defined in the data connection within the report (SQL Server, used in the desing phase as mentioned above).
Any ideas, what we are doing wrong?
Kind regards,
Markus
Edited by: X-Giesi-X on Feb 10, 2010 4:53 PM

Hi Markus
OK. Make sure you have the latest updates. First apply SP 2:
https://smpdl.sap-ag.de/~sapidp/012002523100009038092009E/cr2008win_sp2.exe
Than FP 2.4:
https://smpdl.sap-ag.de/~sapidp/012002523100001024152010E/cr2008_fp24.zip
Next, open the report in the CR designer and enable the "Verify on first refresh" option (File | report Options)
If that does not help, export the report to rpt file format and try to view the exported report in the CR designer. What do you see?
Ludek

Similar Messages

  • While generating a crystal report can we edit database fiels in field explorer (at middle can we edit database fields)

    while generating a crystal report can we edit database fiels in field explorer (at middle can we edit database fields)

    Wrong forum to post the question, try to post the question in crystal reports community.
    Its not possible to edit the database fields while creating the reports, its only used to call the rows of values in it. Can you explain me in detail what are you actually looking for .
    --SumanT

  • While generating a crystal report can we edit database files in field explorer ?

    Hi,
    while generating a crystal report can we edit database files in field explorer (at middle can we edit database fields)
    Regards,
    Mahendra

    Wrong forum to post the question, try to post the question in crystal reports community.
    Its not possible to edit the database fields while creating the reports, its only used to call the rows of values in it. Can you explain me in detail what are you actually looking for .
    --SumanT

  • Fastest way you switch between multiple images (CS3) ?

    I'm originally a Fireworks user (from 2001) and am starting to learn Photoshop as it is in my CS3 set and it's superiority in image editing.
    BUT, I was suprised/shocked/P.O.-ed to notice Photoshop doesn't have tabs to easily switch between images like Fireworks has had for the last 7 years.
    (Yes, I realize CS4 has that option now, but I'm not willing to dole out another $600 bucks for another upgrade )
    Anyway, enough ********.
    My question is:
    "Can you tell me how you switch between multiple images opened in Photoshop CS3?"
    I'm assuming there must be a keyboard shortcut I can't find, or something besides having to shrink down the images and routing through them . . .
    Thank you for your time and help,
    Brad

    Hi again My,
    Thanks for the reply on my other post as well.
    Ctrl+Tab
    Got it. Thank you.
    Quick and easy enough. I'm happy :-)
    Brad

  • Switching between multiple input languages.

    I use English, Korean and Google Japanese. I used to use Windows with the same set of languages and it was even more difficult than in OS X, because each IME may have multiple languages (for example, Korean IME has both Korean and English mode). Now in OS X it is better than Windows because each IME has only single language, but still there are some troubles.
    I use long command + shift. It shows the list in the middle of the screen, but the order is change depending on the current IME. And it only has text, no flag icon, so it is difficult to get the IME I want without carefully watching the screen.
    It looks like OS X does not support assinging a shortcut for each langauge. For example, if I could assign F1 for English, F2 for Korean and F3 for Japanese it would be much easier. Or if only the popup language screen had flag icons...
    Is there any third-party app that helps switching between multiple IMEs?

    If you stop holding down the keys so long, the list should not appear.  Instead, use the flag icons at the top right of the screen to tell which keyboard is active.  If you don't see those icons, go to system prefs/language & text/input sources and check the box for Show Input Menu in Menu Bar.
    I don't know of any way to use keyboard shortcuts in general for this, but the app Nisus Writer has preference settings that let you set that up for that app.

  • Switching between multiple tabs?

    I am currently running Safari 3.2.1, haven't updated to 4 yet...Does anyone know a keyboard shortcut to switch between multiple tabs? Like you can "command+tab" to switch between multiple applications...If I have 2,3,4, etc tabs open in a single window, is there a command to switch between those multiple tabs without using my mouse???

    Simpatico wrote:
    it´s such a pity that Safari cannot abide by industry practice (IE, Chrome, Firefox) some command key + no of tab, instead of associating that to bookmarks.
    What happens after 9 tabs? I regularly have 15+ open.

  • Opening multiple reports in Crystal Reports for VS causes database connect limit to be reached.  Seems to be no way to force Crystal Reports to close database connection (other than exiting application)

    I am working on upgrading an application that has been in use for many years.  The application is written in VB6 and I have been tasked with upgrading the current application to Crystal Reports for Visual Studio.  I am using Crystal Reports for VS Version 13.0.12.1494.  The system's database is a Sybase SQL Anywhere 16 database with an ODBC connection using integrated login.  Each of the reports has the database connection set up from within the report.  There is only once database server, so each of the reports are pointing to the same DB.  The database server is currently installed as a "Personal Server" with a limit of 10 connections. 
    I have implemented the CR viewer as part of a COM-callable wrapper that exposes a COM interface for VB6 to interact with.  Inside of my viewer component is a Winform that embeds the Crystal's Report viewer.  The COM interface basically maps the basic Crystal apis to methods that the VB6 can call (i.e., Load Report, Set Field Text, Update SQL Query, etc).  This architecture is working as designed and the reports are displaying correctly and responding correctly to changes in queries, etc.
    The issue is that after I open 9 reports, the tenth one will respond with an error indicating that the database connection limit has been reached.  The database connections used by the reports aren't released until after the application is closed.  The application is designed for a secure environment that prohibits the non-administrative user from accessing the systems desktop, so asking the user tor restart the application after 10 reports isn't a viable option.
    I have checked and database connection pooling is turned off for the SQL Anywhere 16 driver.
    I have been digging on this for a few days and have tried adding code in the FormClosed event to close and dispose of the Report Document as follows:
    ReportDocument reportDoc= (ReportDocument) crystalReportViewer1.ReportSource;
    reportDoc.Close();
    reportDoc.Dispose();
    GC.Collect();       // Force garbage collection on disposed items
    I have also tried the following (as well as maybe 20 or so other permutations) trying to fix the issue with no success.  
    ReportDocument reportDoc= (ReportDocument) crystalReportViewer1.ReportSource;
    foreach (Table table in reportDoc.Database.Tables)
         table.Dispose();
    crystalReportViewer1.ReportSource = null;
    reportDoc.Database.Dispose();
    reportDoc.Close();
    reportDoc.Dispose();
    reportDoc = (ReportDocument)crystalReportViewer1.ReportSource;
    GC.Collect();       // Force garabe collection on disposed items
    Any ideas or suggestions would be greatly appreciated.  I have been pulling my hair out on this one!

    Hi Ludek,
    Thanks so much for the quick reply.  Unfortunately I did not have time to work on the reporting project Friday afternoon, but did a quick test this morning with some interesting results.  I'm hoping if I describe what I'm doing, you can show me the error of my ways.  This is really my first major undertaking with Crystal Reports.
    If I simply load the report, then close and dispose, I don't hit the limit of 10 files.  Note that I do not logon manually in my code as the logon parameters are all defined within the reports themselves.  The logon happens when you actually view the report.  Loading the report doesn't seem to actually log in to the DB.
    What I did was create a very simple form with a single button that creates the WinForm class which contains the Crystal Viewer.  It then loads the report, sets the ReportSource property on the CrystalReportsViewer object contained in the WInForm and shows the report. The report does show correctly, until the 10 reports limit is reached.
    The relevant code is shown below. More than I wanted to post, but i want to be as complete and unambiguous as possible. 
    This code displays the same behavior as my earlier post (after 10 reports we are unable to create another connection to the DB).
    // Initial Form that simply has a button
      public partial class SlectReport : form
            public SelectReport()
                InitializeComponent();
            private void button1_Click(object sender, EventArgs e)
                ReportDocument rd = new ReportDocument();
                ReportForm report = new ReportForm();
                try
                    rd.Load(@"Test.rpt");
                    report.ReportSource = rd;
                    report.Show();
             catch (Exception ex)
                  MessageBox.Show(ex.Message);
    // The WinForm containing the Crystal Reports Viewer
        public partial class ReportForm : Form
            public ReportForm()
                InitializeComponent();
            private void Form1_Load(object sender, EventArgs e)
                this.crystalReportViewer1.RefreshReport();
                this.FormClosed += new FormClosedEventHandler(ReportForm_FormClosed);
            void ReportForm_FormClosed(object sender, FormClosedEventArgs e)
                ReportDocument rd;
                rd = (ReportDocument)crystalReportViewer1.ReportSource;
                rd.Close();
                rd.Dispose();
            public object ReportSource
                set { crystalReportViewer1.ReportSource = value; }
    Again, any guidance would be greatly appreciated. 

  • One Crystal Report portable to different databases (same database design)

    Good day,
    I apologize first off, as I am NOT a programmer, just a user.
    In summary:
    Crystal Report for data from Sql database.
    Currently using ODBC connection and linking to database.
    However, we have multiple databases, all with the same table structure etc, just different data.
    Right now we change the datasource for each database.
    The crystal report is run from an in house program
    Is there a way we can have the report set so that it will pull the datasource at runtime, and not be hard coded into the crystal report.
    Our goal is to take the one report and have our users of each database be able to access their own data without creating multiple copies of the report with each dataset.
    Thanks,
    RY

    Hi Ryan,
    As per my understanding you have multiple databases with the same database schema however with the different data. You would like to create reports where the user should be able to select which database to use and this should not be hard coded.
    In this case you can use the Business View wherein you have the feature of Dynamic data connection which basically is a pointer to different Data Connections
    A Dynamic Data Connection is a collection of pointers to various Data Connections. An administrator or user is able to select which Data Connection to use through a parameter.
    When users refresh reports that are based on a Dynamic Data Connection, they are prompted to specify which of the available Data Connections to use.
    Note that each of the data sources that a Dynamic Data Connection points to must have similar schemas
    When a Business View designer creates a Data Foundation that is based on a Dynamic Data Connection, this user is prompted to specify which Data Connection to use. Similarly, when a user refreshes a report based on a Dynamic Data Connection, that user is prompted to specify which Data Connection to use. In the usage scenario, you would create one Dynamic Data Connection composed of the three ORACLE sales databases: Sales Development, Sales Testing, and Sales Production. A typical name for such a Dynamic Data Connection would be Dynamic Sales.
    I hope this information helps you and let me know if this works for you.
    Regards,
    Prashant

  • Switching between multiple desktops while using VNC

    Hi All,
    Encountering a minor inconvenience with switching between desktops while VNC-ing. I frequently telecommute and VNC into my work imac, which has parallels + windows 7 installed. My personal machine is a retina macbook pro, and both my macbook and the imac have the newest mavericks installed. I will frequently have multiple desktops open on my imac, but I find that when I am VNC-ing into the imac and then open up parallels in a full window that I am then unable to switch back to my other OS X desktops unless I completely shutdown my windows VM. Normally hotkeys works for me to switch between desktops (and still works when switching from OS X window to OS X window), but it just doesn't do the trick here. I know could just configure my imac so that parallels doesn't open up in full screen mode, which would solve the issue, but I feel like there's gotta be a way to switch desktops while VNC-ing! All tips appreciated!
    Thanks,
    KP

    Hi,
    This is possible using access restrictions in Universe designer based on user login.
    For eg. there is user A,B and C and three connections C1,C2 and C3.
    In Manage access restrictions you have to create a three restrictions(R1,R2 and R3): one using C1,second C2 and third C3.
    Apply these three restrictions to corresponding to the users. i.e. R1-->A,R2-->B and R3-->C.
    So based on user login the instance will be used for same report.
    In IDT , I think this can be done using Data Level Security, but the concept wil be same.
    Thanks
    Gaurav

  • Crystal report "Failed to load database information" error after publish

    I have seen similar questions, but none of the answers seem to apply to my situation.
    I am upgrading an older web application to Visual Studio 2013, using the SAP Visual Studio Crystal Reports tools. Everything works great until I publish.
    I have two sorts of reports: Some that export to Excel, and some that export to PDF. All work fine within Visual Studio. However, when I publish, the reports that should go to PDF give me the following error.
    Failed to load database information.Error in File [Report Name] {GUID}.rpt
    I have seen several posts that indicate that this could be a 32/64 bit issue. I am using a newer 64 bit SQL database, and this is an old application. I have it set to Any CPU. However, since the reports work fine in Visual Studio, I don't see how this could be the issue.
    Any other ideas?
    Thanks,
    Geoff Callaghan

    Hi Geoff
    This is definitely not due to the export type. Rather it will be due to a db issue of some sort. My suspicion is that reports that work use a different type of connection that reports that fail. E.g.; the reports that work use OLE DB, those that fail use ODBC and the ODBC datasource is 32 bit, not 64 bit(?). E.g.; check the database connections between reports that work and those that do not. And remember to also check the connections in subreports (if any).
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • How can I switch between multiple windows of the same application (e.g. Safari) over several desktops ?

    Hi All,
    I have one application, for example safari, open and running with multiple windows (with or without tabs) spread over several desktops.
    How can I switch between the windows only via keyboard? CMD+> and CMD+< let me only swicht between windows open on the one desktop I am currently looking at.
    thanks for your replies,
    equi

    Barney,
    many thanks for your efforts and your time (preparing and posting the screenshot, answering to this question,...).
    Unfortunately, moving the focus to the next window only works with windows on the same desktop.
    btw, using a german keyboard layout and german language settings the shortcut is "cmd+<".
    I can switch with this shortcut between different windows of my Safari which reside on the same desktop, but I cannot swith between different safari windows distributed over several desktops.
    Thanks,
    equi    

  • Crystal Reports Server 2008 Repository Database

    We've configured a new CRS 2008 server and have a "failed reports" report that worked in the old Crystal Enterprise 10 environment.   It would query the repository database CMS_InfoObjects table and report failed reports for the day.
    With the new version of Crystal Reports Server 2008 and the new repository database, the ObjName field and others in this table are now varbinary fields.
    How can we query this field like we did with the old version to get our "failed reports" report to work?
    I can't really find any informatin on the structure, etc. or how to query the repository database.

    Unfortunately, you can't query it directly from a report.  You have to use the query language that comes with the SDK.
    I'm not sure whether CRS comes with the same Query Builder tool that comes with BusinessObjects, but if it does you can access it through a url like this: http://<server name>/AdminTools/querybuilder/ie.jsp.
    To get the list of failed reports, you would run something like this query:
    Select SI_NAME, SI_ID, SI_CREATION_TIME
    from CI_INFOOBJECTS
    where SI_INSTANCE = 1
      and SI_SCHEDULE_STATUS = 3
      and SI_CREATION_TIME >= '2010/08/19,00:00:00'
    Unfortunately, there is no way to automate this with the Query Builder.  You would have to manually run this query every day to get the information you're looking for.
    If you can write code in Visual Studio or Java (or have someone available who can do this), this type of thing is not difficult to do in the SDK.  You could handle it a couple of ways:
    1.  Create a program that loads the information to a table in your database and then run a report in CRS that will show that data.
    2.  Create a program that loads the data into memory and runs a report off of the in-memory data.
    Either type of program could be set to run under the Windows Scheduler to automatically provide the information.
    -Dell

  • Crystal reports asking for login information at runtime

    BH
    Hi,
    I've installed the Crystal Reports for VS2010 (filename: CRforVS_13_0_9).  I've created a new "Crytal Reports Application" Project and I've added dataset which is connected to Access 2010 database. When I create a new report I use the "Project Data > Ado.Net Datasets > CrystalReportsApplication8 > Ledger" as my connection. I connect the report to the CrystalReportViewer in Form1.
    However, when I run the application, I get prompted for a Username and Password. Even though I type in the correct user name and password, it does not let me login and view the report.  I've been struggling for a few days with this.  What am I doing wrong?  I do not want the application to prompt for a username and password, because I've already entered the credentials in the application.  I've searched on the web for a solution, but with no success.  Please help.  I'm using C#.
    Thanks
    Aron

    See if this document will help:
    Crystal Reports Guide To ADO.NET
    Go to page 6 and follow the instructions there. Also, see KBA 1525432 (search box is ion top right corner)
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter
    https://twitter.com/SAPCRNetSup

  • Crystal reports- Calculation between two reports

    Hi Experts
    I have designed a sales and purchase transaction report using crystal reports and i have designed another report for accounting transactions like Excise Duty payable and receivables, Vat payable and receivables, Expenses(like EB, Maintenance) and so on. Finally I added accounting report as sub-report into First Report.
    My question is, is it possible to made some calculations between sub-report and main report.
    Hope some solutions from you.
    By
    Kala

    Hello,
    right upto the linking is good?
    Right now you have to create a formula (which you might have already done for "Total expenses", you just need to alternate it slightly.
    Example:
    On 2nd report (subreport) You might have a formula like given below.
    Instead of Numbervar CAvg, which is the last shown value in the below formula, you have to make it like Shared Numbervar CAvg.
    Whileprintingrecords;
    Numbervar TJs;
    Numbervar TotalJobs=0;
    Shared Numbervar CAvg;
    Shared Numbervar CAvg=0;
    TotalJobs := DistinctCount({lab_credits.credit_no},{lab_credits.reason_code}); 
    CAvg:= TotalJobs /{@WorkingDays};
    TJs:=TJs + CAvg;
    CAvg
    Do your calculation above.
    Now in the main report you will create another formula which will look like below.
    Whileprintingrecords;
    Shared Numbervar CAvg;
    Numbervar TAvg:=fieldname;
    Numbervar TotalBoth:= Shared Numbervar CAvg+ Numbervar TAvg;
    TotalBoth;
    You will have a reset formula which will be placed ontop of the report header , group header if you are using grouping like this
    Whileprintingrecords;
    Shared Numbervar CAvg:=0;
    SHared Numbervar TAvg:=0;
    bearing in mind that we do not have to declare CAvg field here as it is being shared.
    Hope this helps
    Regards
    Jehanzeb

  • Crystal Report Server: Cannot save Database Configuration in CMC

    I already posted this question as SAP internal CSN message (message number 1896093 2009) but did not get any answer so far.
    I have installed a test version (which I'd like to become permanent some     
    day...) of Crystal Reports Server 2008 on a local machine to be able to      
    share Crystal reports within our department.                                 
    I created a couple of reports which I would like to get updated              
    regularly. The issue is here that I get a logon screen to the underlying     
    SQL Server as soon as a user clicks on "Refresh" when viewing a report       
    from InfoView. The SQL Server is running on integrated security              
    via SSO, which I cannot change...                                            
    To get around this issue I would like to change the default Database         
    Configuration of the reports. Hence I do the following:                      
    1) I open the Central Mangement Console                                      
    2) I select one of my reports                                                
    3) Rightclick on Properties                                                  
    4) On the Default tab I select Database Configuration                        
    5) the config is set to "Logon Screen" and I ant to change this to SSO,      
    so I set this                                                                
    6) Now I click on Save                                                                               
    => The setting is reverted to the old "Logon Screen" settin1g                                                                               
    This behavior is the same for all the reports I'm using.                                                                               
    Looking forward to any help, kind regards                                    
    Wolfgang
    P.S.: Ultimately this issue arises, because I cannot refresh my crystal report data in batch job mode, because the reports are reading data from an SQL server, which allows SSO-logon (integrated security) only. Thus I have to open each and every report for update manually and click on the refresh button.
    Edited by: Ralf Wolfgang Geithner on Jul 3, 2009 11:00 AM

    Hi Manish,
    thanks for your answer. Unfortunately I'm still stuck in this matter.
    Does this happen with the sample reports too? I think it will be a good approach to try this to see if your system is behaving differently for sample reports and reports published from outside
    I did not really try this, but viewing and editing my reports in Crystal Reports 2008 Designer works perfectly fine. As well can the user view my reports in the InfoViewApp.
    Also, does it revert to the login screen setting immediately after you click Save or does it show the setting as changed after clicking Save but, does not retain it when you come back and check the report settings again?
    The data is reverted immediately after clicking "Save"
    Kind reagrds
    Wolfgang

Maybe you are looking for