Creating Dynamic DataSets for Crystal Reports in ASP.NET 2.0
page 1 of 3
Published: 28 Feb 2006
Unedited - Community Contributed
This article describes how to use the CrystalReportsViewer and Crystal Report Template components within VS 2005 and how to populate a report from a dynamically generated DataSet at runtime without login errors. This is typically known as the "push" method.
by Chuck Bradley
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 54859/ 56
Article Contents:


[Download Sample]

This article describes how to use the CrystalReportsViewer and Crystal Report Template components within VS 2005 and populate a report from a dynamically generated DataSet at runtime without login errors. This is typically known as the "push" method.


The Environment

Crystal Reports Engine: Version 10.2.3600.0

Visual Studio 2005: Version 8.0.50727.42

MS FrameWork Version 2.0.50727

Desktop OS: Windows XP Pro SP 2

Desktop Hardware: Intel Xeon™ CPU 3.00GHz, 1.00 GB RAM

Language: C#


The Need

I want to allow the client to bring up a web page in a browser, create a DataSet from information on the page or passed in, hook the DataSet into a Crystal Report and view the report within a CrystalReportsViewer component on the page, avoid login errors, and not rely on an XML file being sustained on the server.  The data for the report needs to be generated dynamically, without having to hit a back-end database for the content, and must come from a DataSet created on the fly to populate a Crystal Report to be printed.


The Problem

Creating the DataSet on the fly is straightforward. The idea was to be able to push it into a report within a stateless environment. The issue was that when I tried to load the DataSet object into the report, I kept getting errors in the display of the CrystalReportsViewer.


The Effort

I had tried to hook the Crystal Report Template to a class that would provide a DataSet or a list object that implemented IEnumerable such as a collection or an array from a public property.  The DataBase Expert in the right-click context menu on the Crystal Report Template had no problem finding the class as a Project Data|.NET Object and seemed to bind to the public properties and treat them as fields for the report, which is really cool.

I also tried letting the Viewer add a CrystalReportSource from the ReportSource property and configure the CrystalReportSource to look at the class. At runtime I got various errors depending upon the configuration I was trying.

In the course of these exercises some of the errors were:

Error in File C:\DOCUME~1\MyMachine\ASPNET\LOCALS~1\Temp\PreviewReport {6C87A56E-1E2D-40BE-9FBD-24409A81019F}.rpt: Unable to connect: incorrect log on parameters

Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object. Error in File C:\DOCUME~1\ MyMachine\ASPNET\LOCALS~1\Temp\CrystalReport {7DEF4E8F-DCD1-414A-9242-D51EFBF4A2FF}.rpt: Unable to connect: incorrect log on parameters

I tried resetting permissions on the application folder as well as the AppCode folder where VS 2005 likes to put classes, but was not successful at getting rid of the error.  During all of this I referred to the articles /crystal/redir.aspx?ArticleURL=/532 by Richard Dudley as well as /crystal/redir.aspx?ArticleURL=/490 by Eric Landes.

At this point I'm wondering if my DataSet is getting populated the way it should and whether or not an XML schema file is needed for one of the Crystal components.  I made the DataSet create an XML image file by running the app with the WriteXML method.  I set the Crystal Report Template to look at the XML file in DataBase Expert.  When it ran, I got an error of: "You are not authorized to view this page." The page wasn’t showing the CrystalReportsViewer at all, as I was in an error page of course.

I eventually decided to use a ReportSource from code rather from the toolbar in design view. I found that during configuration changes in design view, VS 2005 would sometimes gracefully ask to shut down; other times it would bail clean off of the desktop by itself.

I deleted the CrystalReportSource from design view, added code to create a ReportDocument object, and pointed it to the Crystal Report Template using the Load method.  It ran fine and was then displaying the static data that was in the XML image file I had made earlier off of the DataSet. If static data is what you need, then that’s OK, but I needed to be able to have dynamic data fill the DataSet at runtime of the page.

By setting the ReportDocument.DataSource property to the DataSet, I was able to get the data from the page rather than the static XML file.


View Entire Article

User Comments

Title: a   
Name: a
Date: 2012-12-17 2:41:34 AM
Title: fdfdfd   
Name: dfdfdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Date: 2012-09-24 5:33:29 AM
Title: dsgkb   
Name: bkjb
Date: 2012-09-18 6:23:24 AM
Title: fjfj   
Name: jfdj
Date: 2012-09-18 6:22:39 AM
Title: Create report dynamically in   
Name: Senthil
Date: 2011-11-19 8:18:56 AM
Hi, I'm having doubt in dynamic report generation. I need to know how get table elements in reports by assigning dataset xsd file to rdlc by bringing the table fields to data web source toolbox. how to generate the table fields in web source toolbox after generating xsd file?
Title: YZ   
Name: bob
Date: 2011-09-08 6:58:11 AM
Please don't publish the fulish things....
Title: Crystal Reports   
Name: Sharique
Date: 2011-07-25 7:48:29 AM
please teach me Crystal Reports how i make a report in c # and so you help me
Title: Dynamic Database field Report   
Name: Nayan
Date: 2011-04-05 4:36:48 AM
i am generation slip for the different company of different database table field so what and how i should have to go for a crystal report pleas give me some example i realy need help
Title: Dynamic Sub reports   
Name: Anbu
Date: 2011-03-29 3:14:09 PM
I've done the crystal report by dynamically loading a typed dataset in report viewer event and it's working fine.. But my prob is "HOW TO LOAD THE SUB REPORTS DYNAMICALLY".. I'm in middle of a project and I'm stuck with this prob.. Pls help me..
Title: Great Dude   
Name: Santosh Waghmare
Date: 2011-03-15 10:47:14 AM
This is real a helpful doc. for all those who want to populate the data on fly.

But I was searching for something which will create the crystal report dynamically mean.. I want each fields and its binding, position should be dynamic
Title: kk   
Name: kk
Date: 2010-12-29 4:58:05 AM
CrystalReportViewer1.ReportSource = cr
Title: Thnx   
Name: Hardeep Singh
Date: 2010-11-22 4:51:38 AM
Can we assign string created through xslt in Crystal Report
Title: Very nice   
Name: Md. Zakir Hossain
Date: 2010-06-28 3:55:14 PM
Very nice article for the beginner who wants to start work working on crystak report with dataset.
Title: load crystal report   
Name: plm
Date: 2010-05-04 12:27:21 AM
Protected Sub Exportport(ByVal sql As String, ByVal DOC_name As String, ByVal PV() As String, ByVal P_VAL() As String, ByVal crs As CrystalDecisions.Web.CrystalReportViewer)
Response.Buffer = False
Dim sqlConn As New SqlConnection(fRP_Conn)
Dim b As New SqlDataAdapter(sql, sqlConn)
Dim dst As New DataSet
b.Fill(dst, "table")
Dim rpt As New ReportDocument()
rpt.Load(Server.MapPath("~/Reports/" & DOC_name & ".rpt"))
If PV IsNot Nothing Or P_VAL IsNot Nothing Then
Dim PAR(UBound(PV)) As ParameterDiscreteValue
Dim PAR_F As ParameterFieldDefinitions
Dim VAL(UBound(PV)) As ParameterValues
Dim cr(UBound(PV)) As ParameterFieldDefinition
PAR_F = rpt.DataDefinition.ParameterFields

For i As Integer = 0 To UBound(PV)
cr(i) = PAR_F.Item(PV(i))
VAL(i) = cr(i).CurrentValues
PAR(i) = New ParameterDiscreteValue
PAR(i).Value = P_VAL(i)
rpt.SetParameterValue(PV(i), P_VAL(i))
End If
' rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "Customersname")
crs.ReportSource = rpt
Catch ex As Exception
ex = Nothing
End Try
End Sub
Title: Problem when got many pages   
Name: Lan D'Chaud
Date: 2010-04-21 7:59:53 AM
umm that's really helping if the report result is only 1 page, but if there is many pages when I press the next or previous button the detail is refreshing to default contain of the XML file..
anyone can help me??
Title: what is the use of XML file   
Name: Anupam Chauhan
Date: 2010-03-30 8:33:53 AM
what is the use of XML file which is written at wwwroot,
I think this is method to show report without xml file.
Title: don't get data in crystalreport   
Name: sejal
Date: 2010-03-19 3:40:17 AM
i want to report by specifying the query in dataset.
but i don't get any error but there is no data in report only header is there.

please help me.
i hope so someone help me.
Title: Could not export or print   
Name: nid
Date: 2010-03-16 9:48:12 AM
Thanks a lot I could show the report but export or search will reset the report to the data in XML. Please help...

Title: Thanks   
Name: Junric Tumon
Date: 2010-02-02 8:39:19 PM
It works. Thanks
Title: DATASET TO CRYSTAL REPORT dynamically   
Name: JIM
Date: 2010-01-19 12:26:50 PM
badly needed a Code that transfer a dataset to a blank crystal report... how to set the fields in crystal report using PURE CODING in VB 2008.. THANK ALOT...

plz email me..
Title: Crystal Report in MVC   
Name: Sanjeev
Date: 2009-12-14 7:48:01 AM
Can anybody tell me how to implement crystal report in mvc. I need to display multiple columns from a table or may be from more than one table.
Title: Bind Crystal Report Dynamically   
Name: Sudhir Barala
Date: 2009-12-11 3:23:10 AM
Sir, I have a big problem with CRYSTAL REPORT. I am using ASP .NET 3.0
I have a employee table in sql database in which have multiple records but I want to disply a specific record of one employee according inserting name in textbox at run time and the report will be shown using crystal Report.
Plz help me.
Title: Awesome   
Name: Bhavin Ahir
Date: 2009-12-05 7:33:42 AM
There IS no Question about your work, I have no word to describe your work.
And This is my first comment On Any Article.
I really Impress by your Work.

But Using This I can not create Columns runtime.
and in my report number of columns decided at runtime.
So, Please If You Have solution for that then kindly reply me on

-Bhavin Ahir
Perception InfoTech.
Title: solution or way for aspx 3.5   
Name: vhera
Date: 2009-11-24 7:23:58 AM
need the solution badly pls help....
The solution here does not fit for Visual studio 2008

email me at
Title: Very Helpful..Thx a lot   
Name: nishant
Date: 2009-11-12 5:41:22 AM
This is a common problem everybody face while dealing with CR ....I didn't get solution .....finally u made my day....:)
Title: sdf   
Name: sdfsdfsdf
Date: 2009-11-04 5:00:41 AM
CrystalDecisions.Shared.ConnectionInfo CInfo = new CrystalDecisions.Shared.ConnectionInfo();
CInfo.ServerName = "SOLIDWORKS2006";
CInfo.UserID = "admin";
CInfo.Password = "admin";
CInfo.IntegratedSecurity = false;
Title: getting error "Report Has No Tables"   
Name: nagaraju
Date: 2009-09-29 5:19:54 AM
i spent days for solve it but i cant .please do any body is having solution please mail me at
I used as code..given below
SqlConnection sqlConn = new SqlConnection("Data Source=SCICOM-557E40FB;Initial Catalog=Employee;Integrated Security=True");
SqlCommand sqlCmd = new SqlCommand("select * from emp", sqlConn);
SqlDataAdapter daTest = new SqlDataAdapter(sqlCmd.CommandText, sqlConn);
DataSet dsTest = new DataSet();


/*GridView1.DataSource = dsTest;

CrystalReportViewer1.Visible = true;
ReportDocument myRpt = new ReportDocument();
CrystalReportViewer1.ReportSource = myRpt;
Title: Crytal report dynamic   
Name: van thuan
Date: 2009-09-22 8:31:31 PM
if you using dataset in crytal report, report will display same table,so, if you want design report, you should create 1 table temp, you will insert data in to it, then, you give data in table tem, you will your report.
Title: Can I use more than one independent table in crystal report   
Name: Pankaj Rai
Date: 2009-09-18 1:53:29 AM
I have to make a report in which data of header section of report came from a table and details section data came from another table which is independent one.Is it possible to use both table for creating a report in ASP.NET 3.5 with C#.
Title: not getting data in crystal report   
Name: sameer
Date: 2009-09-07 2:44:36 AM
i am using the above code and when i am running the crystal report it only shows headers
please help me in this regard
Title: get error "report has no tables"   
Name: feroz
Date: 2009-09-07 12:52:22 AM
please do any body is having solution please mail me at
Title: get error "report has no tables"   
Name: feroz
Date: 2009-09-05 3:36:55 AM
i am getting same error as soma had got
I have a blank crystal report without setting the table from the wizard. My want is to get dynamic dataset for the crystal report, which I will supply from code. While doing all these, I got error saying “The report has no tables”
please help me as soon as possible
Title: try this.this will be work   
Name: vahid farahmandian
Date: 2009-08-24 8:48:41 AM
//I am Sure this will be work.Call me for more information +989373967036
//Here is code behind Init event of report viewer
//Initialize the report options always in "Init" event of
//Report Viewer .............
protected void rptViewer_Init(object sender, EventArgs e)
rptViewer.ProcessingMode = ProcessingMode.Local;
rptViewer.LocalReport.EnableExternalImages = false;
rptViewer.LocalReport.EnableHyperlinks = false;
rptViewer.Visible = true;
rptViewer.ShowBackButton = true;
rptViewer.ShowDocumentMapButton = true;
rptViewer.ShowExportControls = true;
rptViewer.ShowFindControls = true;
rptViewer.ShowParameterPrompts = false;
rptViewer.ShowReportBody = true;
rptViewer.SizeToReportContent = true;
rptViewer.ShowToolBar = true;
rptViewer.ShowZoomControl = true;
rptViewer.DocumentMapCollapsed = true;

//Here is code behind binding of report
protected void rptViewer_DataBinding(object sender, EventArgs e)
string fD = fromDate.VisibleDate.ToString("dd/MM/yyyy").Trim();
string tD = toDate.VisibleDate.ToString("dd/MM/yyyy").Trim();
DataTable dt = new DataTable();
dt = GetData();
// Please notice that ReportDataSet is combination
// from name of dataset and table/tables
// in thie dataset "dsReports_myReport" !!!
string bindDs_name = "dsReports_myReport";
string reportName = "demoReport.rdlc";
rptViewer.LocalReport.DisplayName = "Demo Report";
rptViewer.LocalReport.ReportPath = "Rdl/" + reportName;
ReportParameter from_Date = new ReportParameter();
ReportParameter to_Date = new ReportParameter();
ReportParameter filterFromDa
Title: thanks dost about help   
Name: firdaus
Date: 2009-08-08 3:18:45 AM
hi dost thanks about your help i will try to implement perfect dynamic sub report without any error
Title: Dynamic Crystal report   
Name: Soma
Date: 2009-08-05 3:20:45 AM
I have a blank crystal report without setting the table from the wizard. My intension is to get dynamic dataset for the crystal report, which I will supply from code. While doing all these, I got error saying “The report has no tables”

The code I used was

SqlConnection sqlConn = new SqlConnection("Data Source=SCICOM-557E40FB;Initial Catalog=Employee;Integrated Security=True");
SqlCommand sqlCmd = new SqlCommand("select * from emp", sqlConn);
SqlDataAdapter daTest = new SqlDataAdapter(sqlCmd.CommandText, sqlConn);
DataSet dsTest = new DataSet();


/*GridView1.DataSource = dsTest;

CrystalReportViewer1.Visible = true;
ReportDocument myRpt = new ReportDocument();
CrystalReportViewer1.ReportSource = myRpt;
Title: Download Code Fusion   
Name: Sanjay Gupta
Date: 2009-06-20 8:18:44 AM
Download Code Fusion for fast developing websites in ASP.NET
Developed By:Sanjay Gupta
Title: Goooooooooooood   
Name: Sanjay
Date: 2009-06-12 3:44:46 AM
Pradeep,Sanjay,Harshali,Arul from VAJ Consulting
Crystal Report Viewer in C#
Title: Error i got   
Name: sugumar
Date: 2009-06-01 3:11:17 AM
The maximum report processing jobs limit configured by your system administrator has been reached.
Title: Thanks   
Name: sanjay gupta
Date: 2009-05-31 5:58:01 AM
Thanks a lot code works fine
Title: thankx   
Name: sam
Date: 2009-05-06 6:59:28 AM
your article helped me a lot.thank u so much
Title: How to pass dynamic dataset in subreport   
Name: jomy
Date: 2009-04-07 6:48:27 AM
this is fine but would like to know how to handle subreport
if can help me

‘<<<<, >>>
How to call a Crystal report linked with a Sub-report ??

Dim ADP As New SqlClient.SqlDataAdapter(qry.ToString, con)
Dim DSx As New DataSet
ADP.Fill(DSx, "ReportData")

Dim Rpt As New rptStandardCageV2


CRViewer.ReportSource = Rpt

‘<< how to use set datasource COMMAND IN SUB REPORT

rptExpensiveProducts.OpenSubreport( ?? ?????????????
Title: crystal report   
Name: shrikant
Date: 2009-03-19 3:07:15 AM
Title: Cryatlreport   
Name: pappu kumar singh
Date: 2009-03-02 7:14:47 AM
how to get recored in crystal report from two table in with c#
Title: Page Summary   
Name: Sagnu Shrestha, Nepal
Date: 2008-12-05 1:42:04 AM
Hello My Respected, I need page summary on each page footer. Like Sum of the Amount of it's respected page.
Title: summary fields in crystal report   
Name: Saravan Kumar.R
Date: 2008-11-06 9:37:01 PM
How can view the summary field of a previous page in the current crystal report page........
It's very urgent can any one help me for this .........
Title: Very Very Good   
Name: Sandeep Kumar Srivastava
Date: 2008-11-05 1:33:51 AM
it is very useful Article to use crystal report in Dot Net(c#) 2.0

Title: thanks   
Name: Nick
Date: 2008-10-28 11:41:58 AM
I have spent hours upon hours of messing around with crystal reports and datasets. Your example helped me out. Here is how i got it to work. once you know what SQL statement you are going to use. Create a DataSet with your query, put that DataSet in your CR report so you get your columns in the report, (similar to the steps above) and follow the code logic below. Hopefully this displays correctly, see below:

using CrystalDecisions.CrystalReports.Engine;

SqlConnection sqlConn = new SqlConnection("Connection string to SQL db");
SqlCommand sqlCmd = new SqlCommand("Your custom SQL statement)", sqlConn);
SqlDataAdapter daTest = new SqlDataAdapter(sqlCmd.CommandText, sqlConn);
DataSet dsTest = new DataSet();

daTest.Fill(dsTest, "Table");

CrystalReportViewer1.Visible = true;

ReportDocument myRpt = new ReportDocument();
CrystalReportViewer1.ReportSource = myRpt;
Title: Dynamic Query in crystal report   
Name: nikhil
Date: 2008-10-15 1:09:29 AM
I am working on crystal reportand i need to create dynamic report with 4 sub report and in all sub report same parameter are used. for this i use dynamic cammand but in this parameter are not passed in sub reports. plz help me.
Title: Re:Dynamic Query   
Name: Recep Aslan
Date: 2008-10-08 7:26:03 PM
it's not necessery to create dataset in design time. for datasource of crystalreport you can give datatable which you created in running mode or which you transfer another page via sessions.
Title: thank   
Name: recep aslan
Date: 2008-10-08 7:03:56 PM
thanks a lot . this is very usefull..
Title: need for example screenshort   
Name: manikandan
Date: 2008-09-09 8:31:59 AM
I think if it is screen short for particular program. it may be very useful for user...

G. Manikandan
Title: Sub Report with dynamic columns   
Name: Suhieb
Date: 2008-08-26 8:43:52 AM
This is a grate sample to demonstrate how to make crystal report with dynamic columns.

I was wondering if I can make a sub report with dynamic columns. If it possible, please let me know in my email:

Best Regards
Title: Error   
Name: Sudhir
Date: 2008-08-19 7:57:38 AM
Title: [solution]: using sessions to persist the report file   
Name: ninad
Date: 2008-07-07 12:11:32 AM
>Title: Multiple Page Navigation Problem
>Name: Darshan
>Date: 5/16/2007 3:16:14 AM
>same problem as pragya is having i cant navigate to the next
>page for multipage report

goto this page >
Title: Crystal Reports   
Name: Preetha SG
Date: 2008-06-12 1:11:17 AM
In the report viewer, we have button to export the report to several different formats (RPT, XLS, DOC, RTF etc). Is there is any way to control what gets listed in that drop down list, programmatically?
Title: using XSD + tableadapter datasource   
Name: pete
Date: 2008-05-12 10:23:23 PM
Great help. I am using vs 2008 and wanted to bind a dataset it seems to be slightly differnt in the newer versioun as you create a report viewer and a report source control usually to setup crystal reports. You then use methods through these two objects rather than directly to the report file. Anyway the code below is exactly what I used with a Studentregisters.xsd file created with appropriate table calles studentQueries. Hope this helps someone as it took a while to work out:

StudentRegisters.StudentQueriesDataTable studentDataTable = new StudentRegisters.StudentQueriesDataTable();
StudentRegistersTableAdapters.StudentQueriesTableAdapter studentTableAdapter
= new StudentRegistersTableAdapters.StudentQueriesTableAdapter();
studentTableAdapter.Fill(studentDataTable, "0708", "", "", "smith", 0, 0,0,0,0,"","","",true, "qstudent");
CrystalRepSource.ReportDocument.SetDatabaseLogon("inspiration", "dirtydog", "pongosql", "RDCV2", true);

CrystalRepSource.Report.FileName = Server.MapPath(Session["RunReport"].ToString());
CrystalRepSource.ReportDocument.SetDataSource((DataTable) studentDataTable);
CrystalViewer.ReportSource = CrystalRepSource;
Title: doesn't work for images   
Name: Ian Simpson
Date: 2008-04-28 2:19:35 PM
i tried using this method after getting errors trying to link to a class in the app.code file of my project. This works if you need to push text, but an image wont format right. I write it from a byte[] to xml.
Title: Too Good Article.   
Name: Vicky
Date: 2008-03-19 2:33:58 AM
Very Good Article and very informative .

Thankyou for this article.
Title: thanks   
Name: saga
Date: 2008-03-11 3:01:02 AM
comments of users helped me to solve my crystal report problem. specially this thank goes to "clartsonly".

This is very good and thanks again
Title: Report   
Name: dominic
Date: 2008-03-03 3:41:49 AM
nice article for beginers.
Easy to understand
Title: Excellent   
Name: Ashish Bakde
Date: 2008-02-29 3:22:45 AM
This is a greate article solved my problem with crystal report

Title: Mr   
Name: Joe
Date: 2008-02-20 5:52:06 PM
very helpful article, thank you very much for sharing
Title: Which edition need to run crystal report   
Name: Mani Kumar in India
Date: 2008-02-14 2:40:44 AM
This article very useful to me. But i have tried this example in my system. But in tool box the crystal report viewer is not available. how to i add the cr viewer in form. And also i have one big doubt. Which edition visual studio we want to install for crystal report programs. whether standard edition or profession edition? If it is working in standard edition means please tell me how to work. Because i have standard edition only. Please reply my mail id. My mail id is

Title: Excellent   
Name: Sameer
Date: 2008-01-31 1:09:55 AM
I found you, after reading many site but this tutorial driven me to be a winner.

Title: display run time image in crystal report 2005   
Name: kajal
Date: 2008-01-21 12:54:50 AM
Title: very hepful   
Name: pradeep kumar
Date: 2008-01-17 5:21:23 AM
it is very useful to used to crystal report in c# 2.0
Title: crystal report   
Name: mitesh
Date: 2008-01-10 10:03:29 PM
hi, i want to load crystal report in my website but some how i am not able to do so. So please provide me help for above problem
Title: Superb   
Name: Kirit Raja
Date: 2007-12-07 4:37:15 PM
Works like a charm. Thanks a million.
Title: how to create DrillDown report   
Name: Arvind Sahu
Date: 2007-12-05 11:30:13 PM
i want to implement Drill Down Report in crysatl reports , inbuilt in visual studio 2005.
Kindly reply to my
Title: Crystal Report conversion problem   
Name: Arvind Sahu
Date: 2007-11-26 12:00:45 AM
HI I read your article, its really helpfull. Thank you. I am having a trouble in my report. I have report in which i am using two tables. how can i pass these two tables to dataset and how to pass that dataset to reportdatasource.
please help me.any help will be apprecite. its realy urgent
Second problem is that how to convert crystal report in pdf file...................

Thank you again
Title: use of hyper link in crystal report   
Name: Deepak Dwivedi
Date: 2007-11-06 1:36:24 AM
hi ,
i want open new vb form with taking parameter click on a field of crystal report in (inbuild crystal report) .i solved this problem in, i want it in .
plz mail solution at :
thanks in advance
Title: Data type (got it)   
Name: Amar
Date: 2007-10-31 12:48:17 AM
instead of writexml use
WriteXmlSchema("< filename and path >.xsd");

Thanks and Regards
Amar Chaudhary
Title: Data type   
Name: Amar
Date: 2007-10-30 7:15:12 AM
Thanks for such a helpful article.
I want to know if there is a way to provide datatype along with the structure.

Thanks and Regards
Amar Chaudhary
Title: Dynamic Crystal Report in .net   
Name: Santosh
Date: 2007-10-25 4:57:16 AM
i want to know how to create dynamic crystal report by writting query in textbox and getting result
please kindaly do reply on
Title: Dynamic grouping in .net   
Name: Meghna
Date: 2007-09-24 11:23:08 AM
i want to implement dynamic grouping in crysatl reports , inbuilt in visual studio 2005.
Kindly reply to my
Title: Very Good Article   
Name: Royz
Date: 2007-09-20 1:48:08 PM
Thanks a lot, Chuck. This is a very good example in simple format. And this is exactly what I have been looking for.
Title: my example   
Name: Robert
Date: 2007-08-22 1:24:40 PM
many many thanks, this was very helpful, I'll post my code for further examples. I used VS2005 to create a DataSet class with methods to get the data I wanted, then called them programmatically. I will paramaterize the arguments to the TableAdapter methods (queries) next.

worklogsDS mywDS = new worklogsDS();

worklogsDSTableAdapters.worklogsTableAdapter dtMywTable = new worklogsDSTableAdapters.worklogsTableAdapter();

dtMywTable.FillBySubmittal_Date_Comments(mywDS.worklogs, new DateTime(2007, 8, 1));

CrystalDecisions.CrystalReports.Engine.ReportDocument myReportDocument;

myReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();


Comments.ReportSource = myReportDocument;
Comments.DisplayToolbar = true;
Comments.DisplayGroupTree = false;
Title: how to change the XML File   
Date: 2007-08-06 2:04:39 AM
how to change the XML File Path using Crystal Report object inside VB code
Title: another possible option...for some   
Name: Scott in UT
Date: 2007-08-02 8:10:57 PM
for any of you struggling with a logon error when attempting to "exporttostream", i fixed the problem by placeing the following line of code BEFORE the calling ExportToStream function: "CrystalReportSource1.ReportDocument.SetDataSource(myDataSet)"
Title: HP   
Date: 2007-07-09 7:37:20 PM
HI I read your article, its really helpfull. Thank you. I am having a trouble in my report. I have report in which i am using two tables. how can i pass these two tables to dataset and how to pass that dataset to reportdatasource.
please help me.any help will be apprecite. its realy urgent
Thank you again
Title: can it be used in crystal report source   
Name: cgao
Date: 2007-07-09 3:25:12 AM
i would like to ask if datasets could be used in crystalsource because using the method you have shown i could ue the buttons on the toolbar like print and export button.because if i click it would just refresh my would be much useful for me if i can implement it possible? because i always have to log on to the server of the dataset. how coud i avoid this?
Title: thanks   
Name: ratanjeet
Date: 2007-06-29 3:11:34 AM
Title: Multiple Page Navigation Problem   
Name: Darshan
Date: 2007-05-16 3:16:14 AM
same problem as pragya is having i cant navigate to the next page for multipage report
Title: if fields are also unknown initially???   
Name: Shashank Tiwari
Date: 2007-05-15 8:51:52 AM
the article was really great, helped me lot.
but now i have a problem.
now according to my requirement i need to generate the report plus i dont know about the fields also which will be displayed.
all the data and the name of the fields will be known during runtime.
the data and fields i want to show in report are fetched through SNMP, thus no initial information is with me.
please suggest a way out.
mail me at

thank you all in advance.
Title: how to use use a view instead of a table for getting data into dataset   
Name: Peter
Date: 2007-05-07 11:34:42 AM
can u please solve my problem, i am trying to bring data into the dataset from a view instead of a table by using .xsd but it is not working , it is raising an error no table found.

how do i get data from a view for my report
Title: How Can Add Dynamic Column To Crystal Report During RunTime   
Name: Ripal Patel
Date: 2007-04-20 7:38:02 AM
Hello,I HAve A Dataset. Now I want To import this dataset to Crystal report. i want to add dynamic column to crystalreport depending on, How CaN i GET SOLUTION OF THIS.
My E-Mail Id is
Title: Not Dynamic?   
Name: philip
Date: 2007-04-18 3:12:48 PM
This article was pretty helpful. I have it working in my example until the last step...when I delete the xml file on the server that was initially created, the Crystal Report does not display. Instead I get an error saying the xml file cannot be loaded (since I deleted it). How can I get the report to actually be using the dataset instead of the old initial xml.
Title: Multiple Page Navigation Problem   
Name: Pragya
Date: 2007-04-16 6:16:26 AM
This method works nice.. but when i tried to move to next page the page gone "Blank"... Please help me Wat i do for Multiple Page Navigation
Title: password field null   
Name: Surjyendu
Date: 2007-03-28 7:52:32 AM
Server authentication in SQL Server,when crystal report connection create with server database password field is null.Means every time user and password required,please solve the problem and send solve code in my email,
Title: Displaying multiple pages   
Name: Afnan
Date: 2007-03-06 1:55:47 AM
Everything works fine but the data i am displaying in crystal report viewer is too much. At a time one page data is displayed and when i click the next page icon in crystal report viewer the data is not displayed. Can i program these navigation functions on crystal report viewer explicitly and how? I have tried the ShowNextPage() and other procedures but they are not working.
Title: Error while using Dataset to SetDataSource   
Name: Imran
Date: 2007-02-15 3:14:03 AM
Title: help abt bined the data in   
Name: manjeet
Date: 2007-02-10 8:43:24 AM
if anybody know that how to bind the report in then please send me the coading on
Title: Excellent   
Date: 2007-02-10 12:38:41 AM
Excellent Code
Title: Crystal Report   
Name: Rupesh Kadam
Date: 2007-02-05 7:52:59 AM
If any one know hoe to create crystal report in 2.0. Please help me. Please mail me on this mailid =

Thanks in advance
Title: intermittent error!   
Name: Paul try two
Date: 2007-02-02 7:01:50 PM
Seems to work well but am having a minor problem. I am using a subreport (not sure if this is the problem )as well and but sometimes everything works fine then other times I get the error load report failed for the line dailymaindoc.Load(crystal.rpt"). It is almost like something is getting left in an open state, not sure if I need some sort of close statement.

I have an xml file for both the main report and subreport and am loading both into seperate CrystalDecisions.CrystalReports.Engine.ReportDocuments.
Title: Impresive..!   
Name: Vikram
Date: 2007-01-30 6:40:00 AM
I was really pushing hard to find a solution to for generating a crystal report on the fly. It really helped me.

Title: Dynamic column in report at runtime   
Name: Chandru
Date: 2007-01-29 9:13:34 AM
if u know the technique of create columns dynamically ,
just mail me to the id

Adv thanks
Title: A summary of my Experience   
Name: DaVince
Date: 2007-01-23 1:34:34 PM
Many thanks, I got this to work! Tried to post comments, but they didn't come through. I put them on my blog at

Title: A summary of my Experience   
Name: DaVince
Date: 2007-01-23 12:39:13 PM
Title: all 4 nthg ?   
Name: Mihai
Date: 2007-01-19 2:41:06 AM
It's a solution, BUT THEN WHY DID microsoft WORK HARD (?) to be able to make datasets with connections to different type of data ???
Title: Query   
Name: madhan
Date: 2007-01-05 2:47:27 AM
The article finds good. I am using a report in which i have to display the columns itself based on the stored procedure output.. if there is two column in the output table i have to display the two column details with their corresponding header as such for n number of columns...

pls give me suggesstion

development environment: vs2005, sql2005
Title: Need Help   
Name: Rone
Date: 2007-01-01 5:46:39 PM
i tried the same steps but it give me error message " Invalid Report file path" please if you have any solution to this problem tell me.
Title: excellent   
Name: Ramya Rajaram
Date: 2006-12-12 6:52:10 PM

I was really trying very hard to create dataset dynamically for a report in my application. Your article helped me a loooot. It worked exactly the same way as you had described. I feel your solution is a very easy one. Thank U.
Title: Crystal Report   
Name: basheer
Date: 2006-11-23 1:16:28 AM
i want real code that it's work with Crystal report, 2.0 and 2005.
all code found here not work realy with it.
if there any one know please send me to My Mail:
Title: dynamic report   
Name: rakesh
Date: 2006-11-22 6:21:51 AM
Respected sir,
This is very well article but in web application we have the problem is like that when i am load the crystalreportdocument to my report path at that time this will raise an error something like permission of the security..for the FileIO security permission . now please solve my problem
Title: Dynamic Report Generation   
Name: Himanshu
Date: 2006-11-17 12:52:48 AM
I think the articale above is fantastic..i've searched a hell lot of sites but was unable to find out the solution..the article above just solved my problem.Thanks a lot
Title: When use xls or text file   
Name: Sanjeev
Date: 2006-11-15 9:00:13 AM
I cannot view the data from dataset if I use xls or txt file
Title: Great Job   
Name: Bruce T
Date: 2006-11-13 5:13:14 PM
I am converting a VS 2003 Windows project to Web 2005. This helped tremendously! thank you.
Title: Great work/ Improvements   
Name: Tudor
Date: 2006-11-08 3:26:16 AM
It is really a great job, nice solution. Improvement: can you somehow let the user to choose what columns to be loaded in the report?
Title: Thanks   
Name: Ruwan Pathiranage
Date: 2006-11-08 1:06:56 AM
This is a good solution
Title: Problem   
Name: chris
Date: 2006-10-27 12:44:56 PM
Hi, i have copy the code 1:1

and with the xml file it works, but with "myReportDocument.SetDataSource(myDS);"
or the other 2 commands came this failure:

Can everyone help me please!
Mail to
Title: Sub reports   
Name: Amit Trivedi
Date: 2006-10-12 3:47:59 PM
I started crystal reports with vs2005 few days back and was unable to run vs2003 code to call parameterized stored procedure. your code did run in first attempt but i am wondering how will i manage subreports.

Your help will be apprecited.

Title: Thanks   
Name: hanumantharao
Date: 2006-10-02 8:31:54 AM
hi,thanks for this article is very help ful for me...
Title: Admin   
Name: Yancy
Date: 2006-09-21 7:32:17 PM
Worked great, your step by step was excellent.
Title: thanks   
Name: Hossein Hariri
Date: 2006-09-10 4:02:30 AM
i solved my problem with this way.

Thanks in advance.
Title: Thankyou   
Name: Jason
Date: 2006-09-04 3:32:02 AM
YOu are a genius. Took me next to no time to get up and running and it's added so much more flexibility to my DotNetNuke Module. Ta :)
Title: Its nice   
Name: Jeevesh
Date: 2006-08-24 1:15:35 AM
Really nice article.
Title: Thanks   
Name: Bhaskar Sarma
Date: 2006-08-18 7:07:49 AM
Title: Dynamic Report Generation   
Name: Sarvesh
Date: 2006-07-14 3:05:27 AM
Dear All,

I need to generate a report at run-time where all the fields of report,Where Clause, Dataset Generation will be known at run-time only. So, I do not have any fix format for the report at design time. I just wanted to know whether Crystal Reports can satisfy this requirement or if any other reporting tool can! Or else if you people in this community come across this type of Situation. Pls let me know it will be more usefull for me in my project. And also it is very urgent
Name: clartsonly
Date: 2006-06-26 7:24:47 AM
hmmm not saving my comments.. :(

Saved me some time, the only article I found with this offering, many thanks.

I changed this line


to this

myReportDocument.Load (Server.MapPath("CrystalReport.rpt"));

thanks again

Title: how acn i export d crystal report while using Push Model   
Name: Nikhil
Date: 2006-06-23 6:24:30 AM
hi ....
i am trying to export d crystal report while using dataset (Push Model) but i am getting d error of 'Logon Failed' can some one plz. help me out from this...? if u've such code plz send me on -
Title: Nice(y)   
Name: Irfan Ch
Date: 2006-06-07 2:17:23 AM
Hello Mr. Chuck Bradley!
Your article is too Good;)
it solve my problem.
I have an other problem if u can solve please do help me.
i m building a desktop application using web Services.
now i want to create reports. but i didin't understand how can i do this.
Title: Login Credentials for Dataset   
Name: Mike
Date: 2006-05-17 3:34:31 PM
Something I am missing here. I created a stored proc. In .NET I create the dataset & using the server explorer, choose the Stored Proc. But, does this mean that the dataset is bound to that stored proc. And how do I change it in code? Where in the code do I tell it where to point?
Title: You're The "ONE"   
Name: Daren
Date: 2006-05-15 10:44:02 PM
It's working. Many thanks to you that I don't have to hassle with CR tech support. CR XI R2 and 2005 rock!

Title: logon error   
Name: andrew
Date: 2006-05-08 8:17:40 AM
i have created a dataset using the .net ide. and am trying to populate the dataset and display it in the crystal report. i encounter the logon error. The code for poppulating dataset is given below. any sugesstions would be deeply apriciated

// this code is written inside formload
String conString="Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=E:/asdf/report/receipt.mdb";
String SQLString="Select * from receiptclient";
SqlDataAdapter oDAdap=new SqlDataAdapter(SQLString,conString);
DataSet odataset =new DataSet("mydataset");
Title: why the toolbar is false   
Name: Beatrice munoz
Date: 2006-05-04 7:48:17 PM
Why you are not using the toolbar what happen is i wanna print cause i have my report and i am able to bind using a dataset.xsd but when i pushh the print botton in the toolbar in the crystalreportviewer i get this mesage Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object : Unable to connect: incorrect log on parameters.
Title: code for search button of displaytoolbar in crystelreports   
Name: shashi
Date: 2006-04-08 3:06:41 AM

If any body knows how to implement code for search button, Please send infomation for my

Thank you
Title: Dynamic Column   
Name: Bahadir
Date: 2006-04-05 11:46:18 PM
How about creating columns at runtime ?
So what should I do ? You could not put your fields onto the report at runtime , right ?

If you have some tricks , please e-mail me about your response.(
Thanks in advance.
Title: It works   
Name: Leo
Date: 2006-03-31 8:43:52 PM
You can use the WriteXmlSchema method instead so you wont need to add rows.
Title: 1.0   
Name: Tripathi
Date: 2006-03-30 8:42:59 PM
This works for 1?
Title: Thanks   
Name: anna
Date: 2006-03-24 3:33:42 PM
I was struggling for the better part of the week, trying to export a dataset to crystal reports dynamically. Tried this method and Bingo!

Thanks for your help!

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-23 9:29:11 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search