Frustration and Excitement with Crystal Reports

T

Tony K

Getting the former. Not the latter.

As some of you may know (Terry...btw thanks for all your help), I have been
battling a Crystal Reports problem. I have recently made the discovery that
my "Current Connections" or ADO.NET options for the database expert in CR
are not working with my project.

IF I create a new connection to my Access DB(DAO) or use OLE DB(ADO)
connection I will receive correct data (results) on my report for the first
time. Whew Hoo! If I use my ADO.NET Dataset connection from my "Current
Connections" or from my project, I GET N-O-T-H-I-N-G. By 'nothing' I mean
when the report is shown in the report viewer, not one piece of data shows
up.

I cannot use the ones that work unfortunately because when this entire
project is complete, the Access DB may reside on a network drive (ie.
M:\InventoryManagement.mdb) These paths that are created, I wouldn't know
where to begin to modify them.

How do I fix this $%^&*#@ problem??


Tony K
 
S

SurturZ

I know this will sound flippant, but I think the solution is to ditch Crystal
and write your report in VB. I struggled with Crystal for over a year. For
simple single-table queries it is fine, but once you want a little bit more
than that, you would be better off spending the time learning VB than arguing
with Crystal.

Many reports require record-by-record processing, and Crystal is
spectacularly bad at that.

Your particular problem would disappear with VB, too, since you could
specify your connection string using a path loaded from an INI file.
 
T

Terry

Hi again Tony,
I am not sure I understand the problem. Is CR not able to connect to the
Db? Seems like you would get some error if that was the case. Are you sure
you are setting your parameters corretly - sounds sort of like the query is
running and returning an empty result set. Try doing a report that takes no
parameters and see what happens. As I pointed out in a prior email, if it is
a connection problem, maybe the way to go is to populate a dataset yourself
and then have CR report on the DS and not go to the Db. If you create a
dataset and add a tableadapter based on the query that CR is trying to run.
There is a way in CR to change the datasource from the query to the DS (w/o
having to redo the whole report). You could then fill the DS yourself and
'shove'it to CR so CR will never have to connect to the Db.
BTW, I just started working with CR a couple of months ago - so I am no
expert, but it sure beats the VB PrintDocument (to me anyways). I really
struggled with it for the first month and was abut to &%% can it when I
finally started getting somewhere. The documentation really sucks but if you
stick with it - it will save you a lot of time in the long run.
 
S

SurturZ

I find the problem with Crystal is that it is not very good at handling
reports where you need to compare records with each other in the same table.
For example, if you want to find the newest record before a certain date,
where the date is selected from a different table.

It's difficult to make calendars, too. For example if you have an
appointment database that only has records for those days that have
appointments, it is hard to show the days without appointments because
Crystal's reporting model needs a record to display.

My preferred reporting model is to have a VB program output an MS Word
document. The VB PrintDocument object model is great, but it doesn't allow
you to save the printout in a useful format.
 
T

Terry

Seems to me, both cases are good examples of where you would want to suck the
data into a DataSet, add records programatically (calendar) or filter based
on some other data and then after doing the manipulation - shove the DS to CR
to report on. That way you can concentrate on the logic and not spend time
with a ruler trying to figure out where to place a piece of data on the
report.
 
T

Tony K

Terry,
I did try just a simple report with 3 fields from 1 table. I know there
was/is data in the table I was trying to create a report on. Started from
scratch (with a new form, new viewer...even tried selecting the form from
the smart tag for the CRViewer. I got nothing. It was then I tried, just
for the heck of it, to create a new connection in the Set DataSource
Location from the field explorer. When I noticed that connecting to an
Access/Excel file I could get data using the same form. Without changing
the properties of the fields. Now, I made another connection to connect to
a Jet/OLE DB and that also works. I can view this information by doing the
following. Right click on the Database Fields (from Field Explorer).
Select "Set Datasource Location". Click on the + next to report to expand.
Click on the + next to the database. Click on the + next to properties.
View the Database Type. If it is an ADO.NET Dataset or...from my current
locations "Inventory_management_databaseDataSet" I do not receive any data.
If I create a new connection as a Microsoft.Jet.OLEDB.4.0 Provider / OLE DB
(ADO) Database Type with a path such as "C:\Users\Tony\Documents\...." I can
view the difficult query you helped me on last week. It works GREAT...
Until I deploy to another laptop because the database is not in the same
location as on my laptop. (ps. I have a registry entry I programmed for if
the user wants to move the DB to another location. That is why I would
prefer my "current connection" under the Set Datasource Location. I hope
this explains my dilemma.

Again...thanks for the great info on the parameters. If you would like, you
can email me your email address, I can zip my solution and you can see my
messy code...but it does work.

Tony K
 
T

Terry

Hi Tony,
Sorry, but I am still confused. Some of what you are talking about is at
design time and some is at run time. At design time, your DS won't have any
data in it to report on. But then if you are using a DS, why does CR need to
go to the Db? Don't you fill the DS in code yourself? You originally talked
about having a DGV of the data - does that work?
As far as moving to different machines, creating different paths to the
data, you can set the connection for the report at run time, as I just did a
little poking around to see - never have really done it since I am using SQL
server express.

Dim i As CrystalDecisions.Shared.IConnectionInfo =
myrpt.DataSourceConnections(0)
'you may have to fool with the right hand side to get the right connection -
2 more overloads
i.SetConnection(server, database, user, password)

HTH
 
P

Pankaj

I'm having more than 30 reports in a project and everytime i move the reports to another server i need to change the datasource location of every report separately. Is there any way i can change the datasource location for all the reports through some code. I'm using typed dataset for showing the data in the reports. I would like to get the solution ASAP.
 
M

Mayur H Chauhan

Pankaj,
As per my understanding, you might be binding Dataset to the
report control. In this case, while populating dataset from the database,
read the datasource information from the configuration file which should be
ship along with your tool.

Mayur
 
R

Rich P

If you are using VS2005 (.Net Framework 2.0 or higher), there is a
Report Viewer Control/component. This works about exactly like Sql
Server Reporting Services (for sql server 2000 RS) except that the
report file is a .rdlc instead of a .rdl. You can easily populate a
Report Viewer control from data contained in a local dataset. You can
import your data from whatever source (Access, an xml file, a text file,
sql server ...) into a dataset table. Then you can tweak the data as
you need and display it in the Report Viewer.

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top