Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1484
  • Last Modified:

VB.Net Crystal Reports and Dynamic Datasource

I am creating a vb.net application with sql server 2008/2012 backend.  This will be deployed to different police departments, which of course will have different server names.  I am trying to create the reports using crystal reports.

I did some research on how to set the connection info in the backend code, however during the design of the crystal reports how do I set this up?  Do I need to create a .xsd file and link it?  Or if I set the datasource inside the crystal reports design to my development database, will the code-behind (that changes the datasource) override the datasource selection when I designed the crystal report?

I'm confused, any advice?
0
K-9
Asked:
K-9
1 Solution
 
mlmccCommented:
Probably the easiest method to handle this is to feed the data to the reports using a dataset.

This link has sample code for doing that
http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx

THe beauty of doing it this way is that the application creates the dataset and it is easy to configure the opening of the database in code where as changing the data source of the report can at times be problematic.  WHat works for one doesn't always work for another.

Another idea used on a project where I built the reports.  The application created XML files for the data and the reports were built against them.  The XML files were stored in a known location (application specific) on the system and the reports again didn't have to be changed for different users.

If you want to hit the database directly, you simply build your reports against the development database then the code can be written to change the data source.  The report isn't built in any special way.

mlmcc
0
 
vastoCommented:
There are 2 ways to show data in Crystal :
 - PUSH (get the data in a dataset and pass it to the report)
 - PULL (set connection info and ask the report to retrieve the data)
No matter which one you will use you need to save somewhere the connection string to the database. .NET provides a standard way to do this using connectionsettings section in app.config file. You can also encrypt this section.

Is this a Web  application?
0
 
Éric MoreauSenior .Net ConsultantCommented:
yes passing a dataset already filled to your report is the best way to go.

my article also has a second part @ http://www.emoreau.com/Entries/Articles/2006/10/Crystal-Reports--Part-II.aspx
0
 
Ido MilletProfessor of MIS at Penn State Erie and Owner, Millet SoftwareCommented:
Why not use ODBC DSN as the data source?
Each police department would simply point the DSN to a different server.
0
 
mlmccCommented:
WHy did you accept that as the answer?  The first part of his article is essential to the solution?

mlmcc
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now