Solved

Feeding Crystal Reports with a dataset from .Net

Posted on 2009-05-03
10
953 Views
Last Modified: 2012-05-06
Hi experts,

I recently posted a very similar question but realised I need to go one step further.  I'm writing a VB.Net application with one or two Crystal Reports incorporated.  I'm using .Net framework 2 and VS2005.

My original question was:  how can I pass my crystal report (rpt) a datatable/dataset from my .Net code?  This was answered by the following: http://www.emoreau.com/Entries/Articles/2006/09/Feeding-Crystal-Reports-from-your-application.aspx

This works great if the dataset and XSD comes from a database.  But now I need to pass a dataset that does not come from a database.  I build the dataset and datatable within it by collecting data from other sources.  See example below:

            With ds.Tables("InstanceTasks")
                .Columns.Add(New DataColumn("ReportHeading", System.Type.GetType("System.String", True, True)))
                .Columns.Add(New DataColumn("InstanceName", System.Type.GetType("System.String", True, True)))
                .Columns.Add(New DataColumn("TaskCount", System.Type.GetType("System.Int32", True, True)))
            End With

I then manually populate it with data.

My problem is:  if I provide my crystal report with a XSD Schema written from this dataset, it doesn't show under ADO.Net Datasets.

Is there some other way to pass this dataset to my report?

Please help!
0
Comment
Question by:PantoffelSlippers
[X]
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
  • 5
  • 4
10 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 350 total points
ID: 24290135
>>This works great if the dataset and XSD comes from a database.  But now I need to pass a dataset that does not come from a database.

If you look at my example, you should see that the dataset is not created from the database. I have no connection to any database in this article.

Search for WriteXmlSchema in the page.
0
 

Author Comment

by:PantoffelSlippers
ID: 24290208
Hi Eric,

I did notice that yes but I can't get it to work with anyting other than a database!

If fill a dataset from SQL Server and then wite the XSD I can use it in the report - it shows under ADO.Net Datasets.  If I populate the dataset manually and then write the XSD I can't use it in the report - it doesn't show under ADO.Net Datasets.

One other thing I can tell you is that if I add both XSD's to my project (coming from the db and the one not coming from the db), their icons look different!

Please see attached screenshot showing the different icons.

The XSD coming from the database which works well is called "Frikkie.XSD" and the one that I populated manually that does not work at all is called "ReportDataTableDefition.XSD".

I must be doing something wrong with one the 2nd XSD....

Any ideas?

Thanks

Capture.JPG
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 350 total points
ID: 24290382
One thing which is really not clear in the article (only mentionned somewhere in the comments at the bottom) is that the schema created by WriteXmlSchema will not name the dataset properly.

Open the .xsd file into notepad and replace its name with the name of your dataset as shown here:
  <xs:element name="TestDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 

Author Comment

by:PantoffelSlippers
ID: 24290439
Hi Eric,

Sorry, no.

No luck.  I've taken the XSD that doesn't work and changed the name of the dataset.  I don't think this would be the only problem because under ADO.Net Datasets in a new report, I still get "No items found...."

Are the formats not different somehow?

Is there any significance to the different icons I mentioned before?

Thanks
0
 
LVL 70

Assisted Solution

by:Éric Moreau
Éric Moreau earned 350 total points
ID: 24291310
I do not use Typed Dataset so I don't have the "ready-made" datasets. All I can say is that if you follow the schema creation, rename it correctly, you should see it when you create a new report. If you try to add it to an existing report, CR is somewhat buggy and you have to refresh the datasources many times before it can be seen.
0
 

Author Comment

by:PantoffelSlippers
ID: 24296354
Thanks

I'll try one more time...
0
 

Author Comment

by:PantoffelSlippers
ID: 24512744
Hi

Any other thoughts on this?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 24513014
As I already told, I do not use typed dataset with CR
0
 
LVL 1

Assisted Solution

by:summititsolutions
summititsolutions earned 50 total points
ID: 24652499
Once you've created the second .xsd and placed is somewhere on your file system, go to the database expert.  Go to Ceate New Connection --> ADO.Net --> Make New Connection.  Browse to the .xsd file and click finish.  A new folder named "NewDataSet" will be created  under (Create New Connection --> ADO.Net) and  in this folder you should see your dataset.
0
 

Author Closing Comment

by:PantoffelSlippers
ID: 31577330
Thanks - I still can't get it to work but there is no time left for this.  I'm finding workarounds now.  The problem is most probably with me and not with your solutions suggestions.  Thanks again.
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

691 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