-
Mar 26th, 2018, 04:29 AM
#1
Thread Starter
New Member
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:
This issue appears on a customer server, not on the development machine.
Any idea?
Thanks by advance.
-
Mar 26th, 2018, 07:16 AM
#2
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
-
Mar 28th, 2018, 08:52 AM
#3
Thread Starter
New Member
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)
-
Mar 28th, 2018, 10:00 AM
#4
Re: Connection to database asked by CR
Originally Posted by romulus001
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
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|