last few days i m working with cryatal report 9 and vb.net 2003.
i found some usefull information for crystal report and vb.net. here are some
of that. i have to create a report with some sub report. The report is using
sql stored procedure in back-end. i have to pass it's parameter from vb.net.
there is one primary report and eleven sub report. this is a new experience for
me. i use stored procedure to calculate and retrive complex data from data
base. there was very good use of stored procedure. but finaly i have to work
with crystal report and vb.net for front-end.
'Finaly i create a class to show that report. this are the referance, in that class. Imports System.Data.SqlClient Imports CrystalDecisions.CrystalReports.Engine Dim TheReport As Integer 'i create a function which returm all required informationform database for this report. and pass it in to parameter for crystal report. 'this fucntion return that report document. Private Function generateReport() As ReportDocument Dim tmpCrystalReport As New ReportDocument tmpData = generateBasicInfo() tmpCrystalReport.Load(Application.StartupPath & "\Report\rptMain.rpt") Dim crParameterDiscreteValue As ParameterDiscreteValue Dim crParameterFieldDefinitions As ParameterFieldDefinitions Dim crParameterFieldLocation As ParameterFieldDefinition Dim crParameterValues As ParameterValues ' Get the report's parameters collection. crParameterFieldDefinitions = tmpCrystalReport.DataDefinition.ParameterFields 'not i have to pass all parameters here. as follow: 'there was 36 parameters so i create this procedure "generateReport_child". 'param 1 generateReport_child("@vCenterIDX", tmpData.CenterIDX,crParameterFieldDefinitions, crParameterFieldLocation,crParameterValues) 'param 2 generateReport_child("@vYearIDX", tmpData.YearIDX, crParameterFieldDefinitions, crParameterFieldLocation, crParameterValues) ..... ..... 'finaly generateReport = tmpCrystalReport tmpCrystalReport = Nothing End Function End Function |
Crystal Decisions Project ExamplesVB.NET Web Sample ApplicationsVB.NET Windows Sample Applications
a ready code for sub report click here.
but i had a problem with, when i attach account report more then one time as sub
report in same primary report. i cant successfully pass parameters in that sub
report. if i will found any result for the same put that here letter.
I am getting error at this line tmpData = generateBasicInfo()
ReplyDeletewhen i use ur code
Do we need to call stored proc in that generateBasicInfo()