Link to home
Start Free TrialLog in
Avatar of simmonsusa
simmonsusa

asked on

crystal sub report asking for a parameter value? .net

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
Avatar of Mike McCracken
Mike McCracken

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
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
Avatar of simmonsusa

ASKER

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.
I don't know who abandoned the question I know i didn't, hopefully someone out there can helpp.
Is the data correct in the subreports when you don't link them?

mlmcc
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.
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial