May 4, 2012

Simple Crystal reports In ASP.net


 Dim ObjDb As New DBAccess

    Dim objRptDoc As New ReportDocument
    Dim myDiscreteValue As New ParameterDiscreteValue

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        FunGenerateReport()

    End Sub
    Protected Sub FunGenerateReport()
        Dim strRptFile As String
        strRptFile = Server.MapPath("rptFaapBudget.rpt")
        objRptDoc.Load(strRptFile)


        objRptDoc.SetDatabaseLogon("MyUserName", "PWD", "192.168.1.192", ObjDb.GetConnection().Database.ToString())

        myDiscreteValue = New ParameterDiscreteValue
        myDiscreteValue.Value = Convert.ToString(Request.QueryString("strYear"))
        objRptDoc.ParameterFields("@finYear").CurrentValues.Add(myDiscreteValue)

        myDiscreteValue = New ParameterDiscreteValue
        myDiscreteValue.Value = Convert.ToString(Request.QueryString("strCompCode"))
        objRptDoc.ParameterFields("@CompCode").CurrentValues.Add(myDiscreteValue)

        CrystalReportViewer1.ReportSource = objRptDoc
        CrystalReportViewer1.HasExportButton = True
        'CrystalReportViewer1.HasToggleGroupTreeButton = False

    End Sub

No comments:

Post a Comment

What is the use of n-tier architecture and 3-tier architecture?

how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...