Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8851

Re: Modifying SQL from Crytal Report within V.S. 2012

$
0
0

Hi Eric,

 

This is my first time out with CR10. I am converting CR4.5 reports written for VB6. Some years ago I tried CR8 that came with VS2005.Net, but it didn't have the ability to give it an SQL statement, and who wants a million rows returned to the report viewer if you only want one or two?

 

I use a dataset that was loaded based on my sql where clauses and load it to the report document. In other words, the report is built around a SQL statement that returns all records, but I build a dataset based on parameter entry, and pass it to the report.  There are two problems I have noticed; if no records are returned, ReportViewer is unhappy, displaying an error message about groupings; and if the user clicks on the Group Tree panel to navigate to a specific group, the report display is refreshed from the internal query, displaying ALL rows! I haven't figured out how to deal with that yet. I'm hoping to learn that there is an event I can trap to reload from my query, rather than the full query...If I hide the group panel, the user can still open it, unfortunately.   I also use multiple .RPT files with one viewer.

 

 

privatevoid loadReport(int reportId)

{

     ReportDocument rptDoc = newReportDocument();

     DataTable dt = newDataTable();

     dt.TableName = "Company Report";

 

     dt = getReportRecords(reportId).Tables[0];

 

     string fileName = GetReportFileName(reportId);

          rptDoc.Load(fileName);

          rptDoc.SetDataSource(dt);

          CrystalReportViewer1.ToolPanelView = ToolPanelViewType.None;

          CrystalReportViewer1.ReportSource = rptDoc;

}

 

 

Mark

 






Viewing all articles
Browse latest Browse all 8851

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>