Last post Apr 19, 2012 01:52 PM by avinash_bhudke
Apr 18, 2012 01:25 PM|neha24|LINK
I am new to crystal report so please help me with my problem.
I did created one crystal report and in my web page i do have report viewer but my problem is i can not bind it directly to any database object because i am using active directory and database both. so i am having one datatable in my codebehind where i am
getting all information needed to create any report.
i dont know how to bind my code behind's datatable to crystal report and where i have to do that?
Can you please help me with this?
Apr 18, 2012 01:34 PM|avinash_bhudke|LINK
You need to use ReportDocument's "SetDataSource" method to bind DataTable to crystal report.
Refer the link
Apr 18, 2012 01:46 PM|neha24|LINK
Thanks for your reply but i can not create dataset,
I am getting all personid and their username(Their Company's Email address) and thn i am serching for them in active directory and getting all their information in one datatable then if any information is required for them from database then i am getting
that also in data table.
and finally i am using that datatable so i can not create any dataset and then datatable from database fields.
Please help me if you know something about this
Apr 18, 2012 01:56 PM|avinash_bhudke|LINK
You just need to create new dataset at runtime and add your DataTable to the dataset before calling SetDataSource method of ReportDocument.
ReportDocument rptDoc = new ReportDocument();
DataSet ds = new DataSet();
ds.Tables.Add(datatable); // datatable is your populated datatable.
//set dataset to the report viewer.
CrystalReportViewer1.ReportSource = rptDoc;
Hope it helps.
Apr 18, 2012 02:19 PM|neha24|LINK
thanks for your reply,
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.DataSourceException: The report has no tables.
I am getting this error when i did try to run that code.
i did check this ds there is datatabel in it and 3 rows are there in it but i am not getting whats the problem with it.
Line 68: //set dataset to the report viewer.
Line 69: rptDoc.SetDataSource(ds); Line 70: CrystalReportViewer1.ReportSource = rptDoc;
can you please help me?
Apr 18, 2012 02:46 PM|neha24|LINK
CrystalDecisions.CrystalReports.Engine.DataSourceException was unhandled by user code
Message="The report has no tables."
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataSet dataSet)
at ViewExistingProfile.Page_Load(Object sender, EventArgs e) in c:\WebWorking\TrainingAppNewDB\ViewExistingProfile.aspx.cs:line 70
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Apr 18, 2012 07:50 PM|neha24|LINK
Do i have to do anything in crystal report?? i just created crystal report nothing is in it so do i have to do anything thr?
Apr 19, 2012 01:52 PM|avinash_bhudke|LINK
You can refer these links to get more idea on how to create crystal reports.