Solved

crystal sub report asking for a parameter value? .net

Posted on 2004-09-20
12
324 Views
Last Modified: 2008-01-09
I'm using .net 2002 with crystal 10.

I have a main report linking to a subreport. in Crystal it all works good. individually (without them being linked) they work through .net, however when i include the sub report on the main report and set the datasource correctly for each report, for some reason it asks me to enter a parameter, is there something i'm missing?

Sub BindReport()

        Dim myConnection As New SqlClient.SqlConnection()

        myConnection.ConnectionString = "data source=sqlserver;initial catalog=MAIN;integrated security=SSPI;persist security info=False;workstation id=CHRISTOPHER;packet size=4096"

        Dim MyCommand As New SqlClient.SqlCommand()
        Dim MyCommand1 As New SqlClient.SqlCommand()

        MyCommand.Connection = myConnection
        MyCommand1.Connection = myConnection

        MyCommand.CommandText = "SELECT vw_rpt_DevCase_90.* FROM vw_rpt_DevCase_90 where developmentcasename <> 'Change of Zone' and developmentcasename <> 'Lot Line Adjustment' and developmentcasename <> 'Variance' and developmentcasename <> 'General Plan Amendment' and developmentcasename <> 'Specific Plan'"
        MyCommand1.CommandText = "select top 100 developmentcaseid,timeextdateentered,timeexttermindays,timeextnotes,timeextphonenotificationdate,timeextdatefiled from vw_developmentcasesforinetwithtimeexts2 command"
        MyCommand.CommandType = CommandType.Text
        MyCommand1.CommandType = CommandType.Text

        Dim MyDA As New SqlClient.SqlDataAdapter()
        Dim myda1 As New SqlClient.SqlDataAdapter()


        MyDA.SelectCommand = MyCommand
        myda1.SelectCommand = MyCommand1


        Dim myDS As New DataSet1()
        Dim myds1 As New DataSet1()


        'This is our DataSet created at Design Time      

        MyDA.Fill(myDS, "Cases")
        myda1.Fill(myds1, "Table")


        'You have to use the same name as that of your Dataset that you created during design time

        Dim oRpt As New rpt_DevCase_90()

       ' Set the SetDataSource property of the Report to the Dataset

        oRpt.SetDataSource(myDS.Tables("Cases"))
        oRpt.Subreports.Item("rpt_time_ext.rpt").SetDataSource(myds1.Tables("Table"))

        ' Set the Crystal Report Viewer's property to the oRpt Report object that we created
         cviewer.ReportSource = oRpt
        cviewer.DataBind()


    End Sub
0
Comment
Question by:simmonsusa
  • 3
  • 3
12 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 12108676
Does either of the report use a parameter?  If so you must pass the parameter to the report.

How did you link the reports?

mlmcc
0
 
LVL 2

Expert Comment

by:sajid_bwp
ID: 12109593
hi simmonsusa
It is MUST to give values to all the parameters of the report either on main report or sub report
If you are using the Parameter in sub report and want to give parmater value of Main report, you can use the
RightClick on Sub Report and Click CHNAGE SUB REPORT LINK

Hope this will solve the Issue

Good Luck
Sajid Majeed
0
 

Author Comment

by:simmonsusa
ID: 12113162
There is no parameter. i'm linking each report on a field in each report. I suppose the parameter is the linked field, but would think that crystal would work that out when you have the select field as {?PM-Field name} when i run the report in crystal it's fine and doesn't pompt me for any values obviously. I can get the sub-report to show values only if i don't link them, but when i link them they don't show any value, it's really strange.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:simmonsusa
ID: 12371040
I don't know who abandoned the question I know i didn't, hopefully someone out there can helpp.
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 12439981
Is the data correct in the subreports when you don't link them?

mlmcc
0
 

Author Comment

by:simmonsusa
ID: 12440072
yes if i run the report in crystal it's fine run them seperately it's fine, maybe if anyone has a link to an example of a linked sub-report on the net then that would be great.
0
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 12440926
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now