Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB.Net Crystal Reports and Dynamic Datasource

Posted on 2013-11-07
5
1,393 Views
Last Modified: 2013-11-12
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
Comment
Question by:K-9
5 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 39630217
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
 
LVL 18

Expert Comment

by:vasto
ID: 39630405
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
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 39630414
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
 
LVL 22

Expert Comment

by:Ido Millet
ID: 39634172
Why not use ODBC DSN as the data source?
Each police department would simply point the DSN to a different server.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 39641550
WHy did you accept that as the answer?  The first part of his article is essential to the solution?

mlmcc
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question