Solved

crystal sub report asking for a parameter value? .net

Posted on 2004-09-20
12
319 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

10 Experts available now in Live!

Get 1:1 Help Now