Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 91833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:05:30+00:00 2026-05-10T23:05:30+00:00

In my (Win32) application, I am displaying Crystal Reports. I set the login information

  • 0

In my (Win32) application, I am displaying Crystal Reports.

I set the login information at runtime. However, Crystal kindly decided to refer to the database name by several different names, depending on how the report connects. For instance, if the report connects through an ODBC connection, then it is called ‘Data Source’, but if it connects directly, then it is called ‘Server’.

Of course we don’t know until runtime which report is going to be called.

Currently, I work around the issue by swallowing an exception and trying an alternate method, like this:

procedure TCrystalReporter11.SetLoginInfo(const username, password,   server : string); var   i : integer; begin   //set user name and password   //crystal only accepts these values if they are CONST params   for i := 1 to FRpt.Database.Tables.Count do begin     FRpt.Database.Tables[i].ConnectionProperties.Item['User ID'] := username;     FRpt.Database.Tables[i].ConnectionProperties.Item['Password'] := password;     try       {       Some reports use direct connections, and others use an ODBC Data Source.       Crystal XI uses a different label to refer to the database name in each       method.       I don't know how to determine in advance which method is being used, so:           First, we try the direct connection.           If that fails, we try the 'data source' method.        Reference: 'Crystal Reports XI Technical Reference', pages 41 thru 46;                  'Common ConnectionProperties'       }       FRpt.Database.Tables[i].ConnectionProperties.Item['Server'] := server;     except on E: Exception do       FRpt.Database.Tables[i].ConnectionProperties.Item['Data Source'] := server;     end;   end; end; 

Ideally, I’d like to say something like:

case  FRpt.Database.Tables[i].ConnectionProperties.ConnectMethod of   crymethod_ODBC : sIdx := 'Data Source';   crymethod_Direct : sIdx := 'Server';   ...other methods... end;  //case FRpt.Database.Tables[i].ConnectionProperties.Item[sIdx] := server; 

So my question is:

How can I determine the connection method of a Crystal XI report at runtime, before logging in?

Background info:

  • I’m using Delphi 2007
  • I’m displaying the report using the ActiveX library, which is cumbersome and difficult and stupid and unavoidable (see this post).
  • Reports are in Crystal XI, SP4
  • For the sake of discussion, let’s assume reports are all against an Oracle 10g database
  • My dev machine is using Windows Vista, most users are on XP.

Many thanks for any help that someone can offer.

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:05:31+00:00Added an answer on May 10, 2026 at 11:05 pm

    Look for a DSN item in Tables[i].ConnectionProperties. Non-ODBC won’t have it, ODBC always should, AFAIK.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How do I make my application always use English when displaying win32/.net exceptions messages?
We develop Win32 application that access to SQL 2005 database through Linq to SQL.
We have a Win32 application that hosts the .NET runtime and opens up .NET
We can build VCL Win32 application with runtime packages (*.bpl). These package can be
I am writing a user-space Win32 application. However, as part of this application I
Our win32 application assembles objects from the data in a number of tables in
How can a Win32 application respond to only the first WM_KEYDOWN notification? The MSDN
I have developed a Win32 application using C/C++, which runs on Vista and XP.
I have successfully implemented interop beftween Win32 application and managed .Net dll as described
I am planning on re-writing a Win32 application (native C++) in .NET - most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.