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?
K-9Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Éric MoreauConnect With a Mentor Senior .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
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.