no datas displayed in subreports
i am using Crystal reports10. I have one main report and 2 subreports. i have added a .XSD file in my application and draged 3 tables from the database to the dataset.I binded the stored pocedures to the Maintable.For the main report i have written an stored procedure ie..sp_grpt_procedure and 2 separate stored procedures for 2 subreports.Parameter1 field is common to the main and the subreports. At design time i have selected the databases and binded the appropriate StoredProcedures to the main and the subreports. Now when i use different databases the mainreport displays correct data becoz at runtime i am sending the connectionstring to the dataset .But the subreports are displayed empty.
can anyone give me suggestion to solve this issue.
Protected CrvCAReportPreview As CrystalDecisions.Web.CrystalReportViewer
Dim objtds As New tdsDataset1
Dim objReport As New Report1 //Comment rpt file.
dim sConstr as string
sConstr = Session("ConnectionString") & ";persist security info=true"
Dim col As New Collection
Dim arParams(0) As SqlParameter
col.Add("MainTable")
arParams(0) = New SqlParameter("@Parameter1", Session("Parameter1"))
objtds = SqlAssist.ExecuteTypedDataset(sConstr, CommandType.StoredProcedure, "sp_grpt_procedure", objtds, col, arParams)
Session("tdsReport") = objtds.GetXml
objReport.SetDataSource(objtds)
CrvCAReportPreview.ReportSource = objReport
CrvCAReportPreview.DataBind()
i have also tried another method by adding all the fields in the sp_grpt_procedure ie.. just in one storedprocedures i wrote the fields for the main and the subreport and modified the coding . for the subreports i have specified the same path as the mainreports xsd file.
Protected CrvCAReportPreview As CrystalDecisions.Web.CrystalReportViewer
Dim objtds As New tdsDataset1
Dim objReport As New Report1 //Comment rpt file.
dim sConstr as string
sConstr = Session("ConnectionString") & ";persist security info=true"
Dim col As New Collection
Dim arParams(0) As SqlParameter
col.Add("MainTable")
col.Add("SubTable1")
Col.Add("Subtable2")
arParams(0) = New SqlParameter("@Parameter1", Session("Parameter1"))
objtds = SqlAssist.ExecuteTypedDataset(sConstr, CommandType.StoredProcedure, "sp_grpt_procedure", objtds, col, arParams)
Session("tdsReport") = objtds.GetXml
objReport.SetDataSource(objtds)
CrvCAReportPreview.ReportSource = objReport
CrvCAReportPreview.DataBind()
main report and subreport works fine in local system. when i use different databases mainreport works fine but subreport displays no data.
can anyone tell me how to solve this issue?
|