Wrox Programmer Forums
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 20th, 2005, 06:01 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dhimank
Default Dynamic Reports

Hi,
I am creating reports using a dataset which is being created at runtime.I have a vb.net form to which crystalreportviewer control and a button are added. When I click on the button the reportviewer should show the report.
The code for button as follows
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim cr As New CrystalReport1
        Dim ds As New Data.DataSet("MyTable")
        Dim rds As Data.DataSet
        Dim dt As New Data.DataTable("MyTable")
        dt.Columns.Add("Age1", System.Type.GetType("System.Int32"))
        dt.Columns.Add("Age2", System.Type.GetType("System.Int32"))
        dt.Columns.Add("Age3", System.Type.GetType("System.Int32"))
        Dim dr As Data.DataRow
        dr = dt.NewRow
        dr(0) = 1
        dr(1) = 2
        dr(2) = 3
        dt.Rows.Add(dr)
        dr = dt.NewRow
        dr(0) = 1
        dr(1) = 2
        dr(2) = 3
        dt.Rows.Add(dr)
        dr = dt.NewRow
        dr(0) = 1
        dr(1) = 2
        dr(2) = 3
        dt.Rows.Add(dr)
        dr = dt.NewRow
        dr(0) = 1
        dr(1) = 2
        dr(2) = 3
        dt.Rows.Add(dr)
        ds.Tables.Add(dt)
        cr.SetDataSource(ds)
        cr.SetParameterValue(0, 1)
        CrystalReportViewer1.ReportSource = cr
    End Sub

But when I try to run, it says no tables in the dataset. I am quite pissed with this problem. :( Any one can help me out. Is there any alternatives for this method.
Thanks
Dhiman

 
Old April 28th, 2005, 08:47 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Dhimak:
I am trying to achieve the same thing though I have absolutely no information as to how to even start off with passing parameters from my aspx page, which will act input parameters for the sql query on which the report will be based on.
Can you please guide with that or tell the source where i can look for this specific information.
that is, after a user selects specific options from the aspx page I wish to view the report based on the user choices presented by the aspx page.
 
Old May 10th, 2005, 02:09 AM
Registered User
 
Join Date: May 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

It seems that you creates your dataset dynamically. Such kind of dataset cannot be bind to a report, I guess. I've accomplished your task in the follow steps in C#:

1. Creates a typed dataset.
2. Binds the typed dataset to a report in the report designer.
3. Creates the typed dataset and a datatable dynamically.
4. Sets the data source and report source.

That works in C#. I guess your problem is that you haven't bound your dataset to the report yet.

Good luck!

 
Old May 10th, 2005, 02:13 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 596
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Try converting your dynamic dataset into the typed dataset usign the merge() method.

======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Reports mirabilis C# 0 July 18th, 2005 08:07 AM
Dynamic reports mirabilis Forum and Wrox.com Feedback 0 July 18th, 2005 08:05 AM
Crystal Reports with dynamic XML kncd2005 Crystal Reports 0 May 27th, 2005 12:11 PM
dynamic reports iacon Access VBA 3 December 20th, 2004 03:31 PM
Create Dynamic Reports Raziel Crystal Reports 0 April 13th, 2004 09:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.