Crystal Reports .NET Passing Parameters into SubReports using WebServices tied to SQL Server Stored Procedures

I need help in creating a Crystal report that is tied to independent sub-report items.  Specifically, I can access the main report, but the sub reports are asking me for parameters that which are not associated with my main report (establishing a standard look 'n feel if you're curious about the madness).  

If I was not using a Web Service, I could have full access to the covenanted ReportDocument Object, but according to Brain Bischof's Crystal Reports .NET Programming Book, I am left to suffer with CrystalReportViewer.  

In my frustration, I have downloaded the Crystal Reports sample projects and waded through them to no avail.  If you can help me get from A to Z, I would be greatly appreciative.

Sincerely,

The Tim




RookieTimAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kolpdcCommented:
RookieTimAuthor Commented:
That won't work because you are dealing with the ReportDocument, as opposed to the report viewer.  The ReportViewer is the only solution to developing with a Web Server.  Additionally, the ReportViewer does not know table information...

However, in my frustation, I re-read chapters of the Crystal Reports .Net Programming (pg 331) and discovered that ParameterFields viewer has an overloaded indexer where you can specifiy the sub-report parameter....

Thanks for trying

RookieTimAuthor Commented:
typo....developing with a Web Service....
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

RookieTimAuthor Commented:
Nevertheless, inspite of my recent discoveries, I would be more than elated if someone could give me the a-z (logging into the sever, passing parameters to the main report, and passing parameters to the sub-report)....
Mike McCrackenSenior ConsultantCommented:
RookieTimAuthor Commented:
That was the first thing that I did; however, in my frantic searching, I did not find anything that correlated with my specific problem.  If you could give me the specific code, that would great...

-T
RookieTimAuthor Commented:
I cracked the code!

    Public Shared Sub SetViewerLogonParameter( _
        ByRef crViewer As CrystalReportViewer, _
        ByVal UserId As String, _
        ByVal Password As String, _
        ByVal webRpt As Object, _
        ByVal spName As String, _
        ByVal rptParams As ArrayList)

        Dim Report = webRpt
        Dim crLogonInfo As New TableLogOnInfo

        '--------------------------------------------
        'Set Logon Here
        '--------------------------------------------
        crViewer.LogOnInfo = New TableLogOnInfos
        crLogonInfo.TableName = spName & ";1"

        With crLogonInfo.ConnectionInfo
            .UserID = UserId
            .Password = Password
        End With

        crViewer.LogOnInfo.Add(crLogonInfo)

        '-------------------------------------------------
        'Set Parameters Here
        '-------------------------------------------------
        Dim PFields As New ParameterFields

        Dim P As ParameterField
        Dim spValue As ParameterDiscreteValue

        For Each o As Object In rptParams
            P = New ParameterField
            spValue = New ParameterDiscreteValue

            P.ParameterFieldName = o.Name
            P.ReportName = o.SubReport
            spValue.Value = o.Value
            P.CurrentValues.Add(spValue)
            PFields.Add(P)
        Next

        crViewer.ParameterFieldInfo = PFields

        crViewer.ReportSource = Report
        crViewer.Refresh()
    End Sub

Public Class RptParams

    Public Sub New(ByVal _Name As String, ByVal _Value As String, Optional ByVal _SubReport As String = "")
        Me.Name = _Name
        Me.Value = _Value
        Me.Subreport = _SubReport
    End Sub

    Private _Name As String
    Private _Value As Object
    Private _SubReport As String

    Public Property Subreport() As String
        Get
            Return _SubReport
        End Get
        Set(ByVal Value As String)
            _SubReport = Value
        End Set
    End Property
    Public Property Name() As String
        Get
            Return _Name
        End Get
        Set(ByVal Value As String)
            _Name = Value
        End Set
    End Property

    Public Property Value() As Object
        Get
            Return _Value
        End Get
        Set(ByVal Value As Object)
            _Value = Value
        End Set
    End Property
End Class

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mike McCrackenSenior ConsultantCommented:
Sorry.  I don't have .Net so I have no way to develop code for it.

Did your code solve the problem?
mlmcc
RookieTimAuthor Commented:
Yes
Mike McCrackenSenior ConsultantCommented:
What do you want to do with this question?

If either of the comments was helpful please reward the appropriate expert.

If the comments weren't helpful then I will close this question.

mlmcc
RookieTimAuthor Commented:
The comments were unhelpful because they did not accurately address the issue.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.