In my project i have a mainreport and two subreports.
I am able to work with this only if i have a single query to retrieve datas for all the three reports.
But my requirement is i have to pass three different queries to get data for all the three reports seperately.
The three reports are retirieved form different tables.
As i have used one single query , i have a doubt wheather the query may have if it is put to live database as it will be used by many users at the same time.
I want seperate queries to improve the performance of the report generation
can any one please help to get the solution for my requirement.
thanks in advance.
vijiI've made a lot of Crystal Reports reports using a master detail structure (a main report and subreports describing detail sections). The reports use seperate queries and the subreports can be linked to the main report using the Subreport Links feature in the Edit menu. This works fine in Crystal versions 8.5 ->.
If I want to return a value from a subreport to the main report I use a shared type variable.
I hope this helps, if not please describe in more detail your problem.
- Jukka|||Thanks jukka for your reply.
I created two different DataAdapters and one dataset in the adapters i passed my queries and filled the dataset with the virtual table name and pass this dataset as the datasource for the reports and it is working fine
As i give the data for the variable in the same form itself a shared variable was not needed for me
One main thing is i created all my reports inside the bin directory
the code which i used for the report is
form level::::
Dim Ds_cust As DataSet
Dim Rpt_Doc As ReportDocument
Dim da_cust As SqlClient.SqlDataAdapter
Dim da_tmp As SqlClient.SqlDataAdapter
Dim ls_agree_code, strReportName As String
Button Click:::::
ls_agree_code = Trim(Me.txt_agr_cd.Text)
Ds_cust = New DataSet
Rpt_Doc = New ReportDocument
strReportName = "main_rpt"(give your mainreport name)
Dim strReportPath As String = Application.StartupPath & "\" & strReportName & ".rpt"
If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If
I am filling the dataset thru the different adapters
da_cust = New SqlClient.SqlDataAdapter("select query here", "Server=testserver;User ID=sa;Database=bimscd_test")
da_cust.Fill(Ds_cust, "cust")
da_tmp = New SqlClient.SqlDataAdapter("select query here", "Server=testserver;User ID=sa;Database=bimscd_test")
da_tmp.Fill(Ds_cust, "tmp")
assigning the datasource for the reports
Rpt_Doc.OpenSubreport("sub_rpt.rpt").SetDataSource(Ds_cust.Tables("cust"))
Rpt_Doc.SetDataSource(Ds_cust.Tables("tmp"))
assigning the report source for the report viewer
RptViewer.ReportSource = Rpt_Doc
Rpt_Doc.Refresh()
da_cust = Nothing
Ds_cust = Nothing
No comments:
Post a Comment