Solved

Feeding Crystal Reports with a dataset from .Net

Posted on 2009-05-03
10
937 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
  • 5
  • 4
10 Comments
 
LVL 69

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 69

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
 

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 69

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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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 69

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help parsing JSON in my VB.Net application 4 41
Getfiles in vb.net 28 42
asp.net mvc input file 2 32
Selection between two dates and time range. 21 23
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now