Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 October 13th, 2003, 03:37 AM
Authorized User
Join Date: Sep 2003
Location: , , .
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic columns

Hi guys,

I tried unsuccessfully the whole of last night trying to display a report through a .NET dataset. Before you say it is simple, let me explain what I am trying to do. The report basically has to be totally dynamic. I do not know the schema of the report at compile time. I generate a dynamic dataset and pass it to an empty report. However, I see no data. I thought crystal reports should be able
to infer the schema from the dataset. Right now, I am using a poor man's Datagrid to do the job. However, I will need to generate charts and graphs based on this data and crystal reports would be great
to have.

Here is some C# ASP.NET code that I tried.

    CrystalReportViewer CrystalReportViewer1;
// just a template for an empty report.

TestReport report = new TestReport();
String query = "Select ColumnNames from SomeTable";
SqlCommand sql= new SqlCommand(query, myConn);
DataSet testData = new DataSet("ReportSet");
DataSet tab = new DataTable("ReportSet");

SqlDataReader reader = sql.ExecuteReader();
while (reader.Read())
        // Insert the dynamic column names
    tab.Columns.Add(reader.GetString(0), typeof(System.String));

// Some method follows for filling the dataset

// Now, basically the next 2 lines should do it.
CrystalReportViewer1.ReportSource = report;
// However, NADA! Just an empty report :-((

I would REALLY appreciate it if someone can help me with this. Would even buy beer if they are around
Munich sometime :D

Old August 30th, 2007, 11:07 AM
Registered User
Join Date: Aug 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

Did you find a solution to this issue? I am trying to accomplish a similar goal.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Columns tray99 XSLT 2 July 29th, 2008 01:25 PM
Dynamic columns in data controls p330418 ASP.NET 2.0 Professional 0 April 10th, 2008 11:10 PM
Dynamic creation of Columns in datagrid p330418 ASP.NET 2.0 Basics 0 March 29th, 2008 07:33 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava BOOK: Professional SQL Server 2005 Reporting Services ISBN: 0-7645-8497-9 1 March 24th, 2008 07:58 AM
Dynamic Columns & Dynamic Grouping ??? nileshgambhava SQL Server 2005 0 December 12th, 2006 12:45 AM

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