locked
Please help me how to use the dataset accuratelty to perform the crystalreport.setdatasource RRS feed

  • Question

  • User-786564416 posted

    I have the following vb.net code

    Protected Sub OfficeExecute_Click()
    
    If page.isvalid=True then
        LoadReportData()
        Dim crystalReport as new reportDocument()
        crystalreport.load((Server.mappath("~/Reports/FollowUp.rpt"))
        'The Place where the crystalreport.setdatasource(...) statement should located
        CrystalReportViewer1.ReportSource=crystalreport
        Response.redirect(httpcontext.current.request.url.tostring(),True)
    endif
    
    End Sub

    1. The underlying table which the crystal report use is "FollowUpReportSource"

    2. I have a "~\App_Code\FollowUpDataSet.xsd" dataset which consists of only the table FollowUpReportSource.

    3. The Fill query used to fill the FollowUpDataSet.xsd, is using parameter @UN (nvarchar(50) as following

    SELECT        GNo, GRefNo, GSource, GSourceName, GSourceDesc, GTarget, GTargetName, GTargetDesc, GSubject, GPostDate, GPostType, GRequiredAnsPeriod, GProcessingStatus, GClosed, GImportance, GLate, No,
                             LetterID, Source, SourceName, SourceDesc, Target, TargetName, TargetDesc, PostDate, PostDateLong, PostType, ShownPostType, RequiredAnsPeriod, Importance, ActionAgainstLetter, LoggingUserName,
                             LoggingTime
    FROM            FollowUpReportSource
    WHERE        (LoggingUserName = @UN)

    4. The value should passed to @UN = session("username")

    5. my connection string already defined as myconnection.

    According to the above, How to prepare the dataset and then use it in the CrystalReport.SetDataSource(...) ?

    Tuesday, January 27, 2015 2:36 AM

All replies