Solved

Feeding Crystal Reports with a dataset from .Net

Posted on 2009-05-03
10
948 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
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio hangs on running project 6 83
Using/Import statement in code doesn't see reference of dll just added. 3 39
Adjust the codes 3 63
Convert a string to date 4 40
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 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