Results 1 to 4 of 4

Thread: Connection to database asked by CR

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Location
    France
    Posts
    15

    Exclamation Connection to database asked by CR

    Hello everyone,

    I'm facing with a new issue with Crystal Report (from VS 2008), strangely, by launching an overview of the report, CR asks a connection to a database (SQL Server), the SQL instance is already mentioned but not the database name:

    Name:  CR_identifiants.PNG
Views: 472
Size:  30.1 KB

    This issue appears on a customer server, not on the development machine.
    Any idea?
    Thanks by advance.

  2. #2
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,522

    Re: Connection to database asked by CR

    When you open a Crystal Report, you have to give it the connection info needed to the database where the query/data exists. You don't want production reports running off of the test database do you? Odds are your users don't even have access to the test database anyways. And obviously it isn't magic so unless you tell it, it doesn't know about the production database. If I remember right, there's a method .SetDatabase or .SetConnection, that allows you to set the connection string for the database you want the report to run against. You can set it at run-time, when you open the report, before displaying it. If you report also has subreports, you'll want to iterate through each of those as well and call .SetDatabase/.SetConnection on each subreport too.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2014
    Location
    France
    Posts
    15

    Re: Connection to database asked by CR

    Hello techngnome,
    The test server is connected to the test database to validate the new modifications provided in the new version of the application, therefore, the connection string to the database is different than on the production server.
    For now, the only user who can run the test application is me, the folder which hosts the application isn't shared yet to other users. By realizing some new tests, I discovered 2 things :
    - only the reports I changed open this pop up I showed in my first post
    - only these specific reports open a PDF file and a second report (in the way the first page to display is an invoice, the second page is a documentation)

  4. #4
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,522

    Re: Connection to database asked by CR

    Quote Originally Posted by romulus001 View Post
    Hello techngnome,
    The test server is connected to the test database to validate the new modifications provided in the new version of the application, therefore, the connection string to the database is different than on the production server.
    For now, the only user who can run the test application is me, the folder which hosts the application isn't shared yet to other users. By realizing some new tests, I discovered 2 things :
    - only the reports I changed open this pop up I showed in my first post
    - only these specific reports open a PDF file and a second report (in the way the first page to display is an invoice, the second page is a documentation)
    Riiiiight. So that just confirms everything I said. In CODE, you have to redirect the connection string of the report to point to the RIGHT database when you show the report. The connection is embedded into the CR when you design it. Presumably, you designed it against the test database. so it has the connection to the TEST database embedded in it when you deploy it. That's why there are methods built-in that allow you to .ChangeDatabase (I think I have that name right) ... so that at run-time, you can change what database (and server) the report connects to.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width