NewBie Crystal Report Questions

Free_Man

Member
Joined
Dec 18, 2007
Messages
6
Programming Experience
Beginner
I nearly have no idea about crystal report and now i need to use it to generate some reports but before i start i want to know several things.If the questions sound so lame, sorry for that...I would appreciate if you could give some examples or links.

-Is it possible to generate report from a specific SQL statement with variable which changes in run time?! Like employee information as a report but employee id will be sent at run time as user will select from a datagridview. SQL could be "SELECT * FROM employee WHERE id=x" x will not be static.

-how could i use a CrystalReportViewer for multiple reports. What i do now is, I add a windows form, add a CrystalReportViewer on it and then set the ReportSource. I'll have more than one type of report so i don't want to repeat this process all the time, there should be some easy way.
 
Hi,

You can do the first question if the SQL statement accepts a parameter when the SQL command is performed
 
i tried to dig something from my examples..

after createing a stored procedure (i use SQL server Express edition as a database)

from VB and crystal reports i do the following:

VB.NET:
            Dim report As New myreport
         
            report.Load("myReport.rpt")
            'loading the dataset i created before
            report.SetDataSource(globalDataSet)
            'the crystal report viewer
            allDataCrystalReportViewer.ReportSource = report
            'passing the parameters
            report.SetParameterValue("@Name", globalName)
            report.SetParameterValue("@Surname", globalSurname)

sorry but i dont have well explained examples atm but HTH :)
 
Back
Top