473,395 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Web Service + DataSet + Crystal Report?

Maybe this is an easy thing to do, but I'm just not seeing how it's done
(or at least how it's done properly). I have a web service running on a
remote machine which returns a DataSet. I can easily write an xsd file
to define that DataSet, if need be. Now, on a local Windows Forms
application, I need to have a CrystalReportViewer open up a Crystal
Report which needs to get its data from that Web Service.

How would this be done? It's really the first time I've used Crystal
Reports while learning .NET and everything I see online seems to rely on
directly connection to a database, which isn't the case here.

I tried writing the xsd file and opening that in Visual Studio and using
it to generate a DataSet. I then created a DataSet object on my form
which inherits its structure from that generated one. I used this
DataSet to create the Crystal Report file (very simple report) and put
the right fields in the right places. But now how do I hook in the data
from the web service at runtime and then show the report in the
CrystalReportViewer?
Regards,
David P. Donahue
dd******@ccs.neu.edu
http://www.cyber0ne.com
Apr 4 '06 #1
3 3553
Hello David,

As I remember, Crystal has DataSource where you can point your DataSet from
webService

DD> Maybe this is an easy thing to do, but I'm just not seeing how it's
DD> done (or at least how it's done properly). I have a web service
DD> running on a remote machine which returns a DataSet. I can easily
DD> write an xsd file to define that DataSet, if need be. Now, on a
DD> local Windows Forms application, I need to have a
DD> CrystalReportViewer open up a Crystal Report which needs to get its
DD> data from that Web Service.
DD>
DD> How would this be done? It's really the first time I've used
DD> Crystal Reports while learning .NET and everything I see online
DD> seems to rely on directly connection to a database, which isn't the
DD> case here.
DD>
DD> I tried writing the xsd file and opening that in Visual Studio and
DD> using it to generate a DataSet. I then created a DataSet object on
DD> my form which inherits its structure from that generated one. I
DD> used this DataSet to create the Crystal Report file (very simple
DD> report) and put the right fields in the right places. But now how
DD> do I hook in the data from the web service at runtime and then show
DD> the report in the CrystalReportViewer?
DD>
DD> Regards,
DD> David P. Donahue
DD> dd******@ccs.neu.edu
DD> http://www.cyber0ne.com
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Apr 4 '06 #2
Funny you should mention that... I'm just now working on our code that
does something similar. Here is a snippet from our code that does
something similar to what you want to do. You will have to write some
C# "glue" to mediate between the Web Service and Crystal, but this
should get you started:

private bool LoadUpCrystal()
{
if (this.crystalDoc == null)
{
try
{
if (!ReadCrystalInformation(out this.data, out this.reportName, out
this.templateName))
{
return false;
}
else
{
this.crystalDoc = GetEmptyReport(this.templateName,
this.reportName);
this.crystalDoc.SetDataSource(this.data);
}
}
catch (Exception ex)
{
MessageBox.Show("Crystal ReportDocument " +
"would not accept/print the XML data in " +
"the file '" + this.printFileName + "' (" +
reportName + ")\n" +
"There is probably a mismatch between this " +
"data and the report template '" +
templateName + "'\n" +
ex.ToString(),
WindowsReportPrinter.ErrorMessageTitle,
MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
}
return true;
}

private static ReportDocument GetEmptyReport(string
reportTemplateFileName, string defaultReportName)
{
ReportDocument crystalDoc = new ReportDocument();
try
{
crystalDoc.Load(reportTemplateFileName,
OpenReportMethod.OpenReportByTempCopy);
}
catch (Exception ex)
{
throw new ArgumentException("Unable to load Crystal Report '" +
reportTemplateFileName + "'.", ex);
}
if (crystalDoc.SummaryInfo.ReportTitle == null ||
crystalDoc.SummaryInfo.ReportTitle.Length == 0)
{
crystalDoc.SummaryInfo.ReportTitle = defaultReportName;
}
return crystalDoc;
}

Apr 4 '06 #3
Ah. I never did see a DataSource property, but when you said it's there
it got me looking a little harder and I found a SetDataSource() method.
Your push in the right direction helped me find the page:

http://www.vbcity.com/forums/topic.asp?tid=10205

(which was easy enough to translate into C#) and that made it as simple
as can be. Now it works great, thanks!
Regards,
David P. Donahue
dd******@ccs.neu.edu
http://www.cyber0ne.com

Michael Nemtsev wrote:
Hello David,

As I remember, Crystal has DataSource where you can point your DataSet
from webService

DD> Maybe this is an easy thing to do, but I'm just not seeing how it's
DD> done (or at least how it's done properly). I have a web service
DD> running on a remote machine which returns a DataSet. I can easily
DD> write an xsd file to define that DataSet, if need be. Now, on a
DD> local Windows Forms application, I need to have a
DD> CrystalReportViewer open up a Crystal Report which needs to get its
DD> data from that Web Service.
DD> DD> How would this be done? It's really the first time I've used
DD> Crystal Reports while learning .NET and everything I see online
DD> seems to rely on directly connection to a database, which isn't the
DD> case here.
DD> DD> I tried writing the xsd file and opening that in Visual Studio and
DD> using it to generate a DataSet. I then created a DataSet object on
DD> my form which inherits its structure from that generated one. I
DD> used this DataSet to create the Crystal Report file (very simple
DD> report) and put the right fields in the right places. But now how
DD> do I hook in the data from the web service at runtime and then show
DD> the report in the CrystalReportViewer?
DD> DD> Regards,
DD> David P. Donahue
DD> dd******@ccs.neu.edu
DD> http://www.cyber0ne.com
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche

Apr 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pushpendra | last post by:
I want to create the crystal report in my VB.net application...the connectivity and creation of dataadapter and dataset is done thru coding...the dataset we get is untyped now how to bind this...
1
by: Bob Skutnick | last post by:
Help.... I've created an ADO.NET dataset in Visual Studio (a web project). I build the project and then try to create a Crystal Report using the dataset. When I try to use the ADO.NET dataset...
3
by: Colin Graham | last post by:
I have recently created a report in crystal(10) linking to a dataset as the datasource. I notice however that the fields available in the report all have STRING format and therefore i cannot change...
0
by: Kim | last post by:
I have a crystal report that is using datasets and everytime I run the application a login screen pops up. Why is this? I went on the Crystal Reports Website and found this bit of code that...
2
by: Ceri | last post by:
I have been trying to display dataset data in a Crystal Report in a Crystal Reports Viewer using VB.Net. Displaying the data from the default xtreme.mdb Access database was no problem, but when...
1
by: Sachin | last post by:
Hi, I am working on ASP.Net 2.0 Beta 2 I am having problems creating crystal report using dataset I created a new dataset (DS_ExpCode) and a datatable (DT_ExpCode) under App_Code folder....
3
by: jason | last post by:
I'll try to explain in detail what it is I'm struggling with. I created a SQL database with one table called CallSheet which contains the following columns: Caller ID: <--Primary Key, auto...
1
by: mike11d11 | last post by:
For some reason I'm getting no data populating in my crystal report. I built my crystal report off my dataset in my project, and I fill the dataset when opening the main form, and count the...
6
by: Simone | last post by:
Hello Here is my issue, I created a crystal report using a data set from my xsd. Then I created a page with the crystal report viewer control and bound the report to it. When I try to view...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.