Advertisement

08.11.2003 at 01:31PM PDT, ID: 20706429
[x]
Attachment Details

Crystal Reports 9 with ASP.NET using Dataset

[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2
Tags:

crystal, report, dataset, using

I have a problem displaying the report on send page.... I have some parameters uses the store procedure to reterive the data using dataset. Here is the code I have wriiten the display the crystal report...

Imports Oracle.DataAccess.Client
Imports System
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Microsoft.Win32
Imports CrystalDecisions.Web
Imports CrystalDecisions.Shared


Public Class WebForm2
    Inherits System.Web.UI.Page
    Public rsObj As DataSet
    Public oRpt As cryOmittedFilers
    Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
    Protected WithEvents txtTaxYear As System.Web.UI.WebControls.TextBox
    Protected WithEvents optMineralType As System.Web.UI.WebControls.DropDownList
    Protected WithEvents optCounty As System.Web.UI.WebControls.ListBox
    Protected WithEvents btnFirstPage As System.Web.UI.WebControls.ImageButton
    Protected WithEvents btnLastPage As System.Web.UI.WebControls.ImageButton
    Protected WithEvents btnNextPage As System.Web.UI.WebControls.ImageButton
    Protected WithEvents btnPrevPage As System.Web.UI.WebControls.ImageButton
    Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()

        CrystalReportViewer1.ReportSource = oRpt
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        CrystalReportViewer1.Visible = False
parameters using for stored procedure..
        txtTaxYear.Text = CStr(Year(Now()))-------text box
        Call WriteMinerals()-------------dropdownlist
        Call GetAllCounties()----------listbox
        optCounty.Rows = 10
        optCounty.SelectionMode = ListSelectionMode.Multiple
    End Sub

    Sub WriteMinerals()
        Dim dbAccess As New (DLL USED)
        Dim rsObj As DataSet
        Dim par(1) As OracleParameter
        Dim intpar1(12) As Integer
        Dim intpar2(12) As Integer
        Dim intCounter As Integer
        Dim strMiniralType As Array
        Dim intSNO As Array

        For intCounter = 0 To 11
            intpar1(intCounter) = 25
            intpar2(intCounter) = 3
        Next

        par(0) = New OracleParameter("MINERAL_TYPE", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.Output)
        par(0).CollectionType = OracleCollectionType.PLSQLAssociativeArray
        par(0).ArrayBindSize = intpar1
        par(0).Size = 12
        par(1) = New OracleParameter("SNO", Oracle.DataAccess.Client.OracleDbType.Int32, ParameterDirection.Output)
        par(1).CollectionType = OracleCollectionType.PLSQLAssociativeArray
        par(1).ArrayBindSize = intpar2
        par(1).Size = 12
        dbAccess.ExecuteNonQuery("Mineral_Types_Pkg.sp_Mineral_Types", par)

        strMiniralType = par(0).Value
        intSNO = par(1).Value
        For intCounter = 0 To strMiniralType.Length - 1
            optMineralType.Items.Add(New ListItem(strMiniralType(intCounter).ToString, intSNO(intCounter).ToString))
            ' Response.Write("<option value=" & intSNO(intCounter).ToString & ">" & strMiniralType(intCounter).ToString & "</option>")
        Next

    End Sub

    Sub GetAllCounties()
        Dim dbAccess As New (DLL USED)
        Dim rsObj As DataSet
        Dim par(1) As OracleParameter
        Dim intpar1(200) As Integer
        Dim intpar2(200) As Integer
        Dim intCounter As Integer
        Dim intCountyKey As Array
        Dim strCountyName As Array

        For intCounter = 0 To 199
            intpar1(intCounter) = 3
            intpar2(intCounter) = 25
        Next
        par(0) = New OracleParameter("COUNTY_key", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.Output)
        par(0).CollectionType = OracleCollectionType.PLSQLAssociativeArray
        par(0).ArrayBindSize = intpar1
        par(0).Size = 200
        par(1) = New OracleParameter("COUNTY_NAME", Oracle.DataAccess.Client.OracleDbType.Varchar2, ParameterDirection.Output)
        par(1).CollectionType = OracleCollectionType.PLSQLAssociativeArray
        par(1).ArrayBindSize = intpar2
        par(1).Size = 200
        dbAccess.ExecuteNonQuery("PKG_UMASTSAGETCOUNTYSHORT.sp_KRCUMASTSAGetAllCounty", par)

        intCountyKey = par(0).Value
        strCountyName = par(1).Value

        For intCounter = 0 To intCountyKey.Length - 1
            optCounty.Items.Add(New ListItem(strCountyName(intCounter).ToString, intCountyKey(intCounter).ToString))
        Next
        'For intCounter = 0 To intCountyKey.Length - 1
        '    Response.Write("<option value=" & intCountyKey(intCounter).ToString & ">" & strCountyName(intCounter).ToString & "</option>")
        'Next

    End Sub

    Private Sub CallReport()
        Dim ParamFields As New CrystalDecisions.Shared.ParameterFields()
        Dim ParamField As New CrystalDecisions.Shared.ParameterField()
        Dim DiscreteVal As New CrystalDecisions.Shared.ParameterDiscreteValue()
        Dim par(3) As OracleParameter
        Dim dbAccess As New (DLL USED)

        If rsObj Is Nothing Then rsObj = New DataSet()
        If oRpt Is Nothing Then oRpt = New cryOmittedFilers()

        par(0) = New OracleParameter("p_inttaxyear", OracleDbType.Int64)
        par(0).Size = 4
        par(0).Value = txtTaxYear.Text
        par(0).Direction = ParameterDirection.Input
        par(1) = New OracleParameter("p_intmineraltype", OracleDbType.Int64)
        par(1).Size = 4
        par(1).Value = optMineralType.SelectedItem.Value
        par(1).Direction = ParameterDirection.Input
        par(2) = New OracleParameter("p_varcountycode", OracleDbType.Varchar2)
        par(2).Size = 4
        par(2).Value = optCounty.SelectedItem.Value
        par(2).Direction = ParameterDirection.Input
        par(3) = New OracleParameter("p_omittedfilers", OracleDbType.RefCursor)
        par(3).Value = DBNull.Value
        par(3).Direction = ParameterDirection.Output

        dbAccess.Connection.Open()
        dbAccess.Connection.BeginTransaction()

        rsObj = dbAccess.ExecuteDataset("PG_UMAST_REPORTS.SP_OMITTED_FILERS", "OmittedFilers", par)

        rsObj.AcceptChanges()

        oRpt.SetDataSource(rsObj.Tables("OmittedFilers"))

        '  If Not (IsPostBack) Then
        ParamField.ParameterFieldName = "parTaxYear"
        DiscreteVal.Value = "Tax Year: " & txtTaxYear.Text
        ParamField.CurrentValues.Add(DiscreteVal)
        ParamFields.Add(ParamField)
        ParamField = New CrystalDecisions.Shared.ParameterField()
        ParamField.ParameterFieldName = "parMineralType"
        DiscreteVal = New CrystalDecisions.Shared.ParameterDiscreteValue()
        DiscreteVal.Value = "Mineral Type: " & optMineralType.SelectedItem.Text
        ParamField.CurrentValues.Add(DiscreteVal)
        ParamFields.Add(ParamField)
        CrystalReportViewer1.ParameterFieldInfo = ParamFields
        ' End If
        CrystalReportViewer1.Visible = True
        CrystalReportViewer1.DisplayGroupTree = False
        CrystalReportViewer1.DisplayToolbar = True
        CrystalReportViewer1.ReportSource = oRpt
        CrystalReportViewer1.PageToTreeRatio = 4
        CrystalReportViewer1.DataBind()

    End Sub

    Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Call CallReport()
    End Sub

    Private Sub btnFirstPage_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnFirstPage.Click
        CrystalReportViewer1.ShowFirstPage()
    End Sub

    Private Sub btnNextPage_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnNextPage.Click
        CrystalReportViewer1.ShowNextPage()
    End Sub

    Private Sub btnLastPage_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnLastPage.Click
        CrystalReportViewer1.ShowLastPage()
    End Sub

    Private Sub btnPrevPage_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnPrevPage.Click
        CrystalReportViewer1.ShowPreviousPage()
    End Sub
End Class

Run's fine for the first page...when I hit showNextPage Button does not do anything. Since the page is running at server when I do anything it just submits whole page. Can you please tell me how to get on to second page without executing the stored procedure again. I have report with 200 pages and I do not want to goto server for 200 times. I donot want to export the data. It might be good idea to export, but the client wants to see on the browser without opening the PDF. Appreciate in advance. Any help appreciated. Let me know if you need anything else.
 
Expert Comment by mnye:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Expert Comment by PWinter:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Accepted Solution by mnye:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Administrative Comment by TheLearnedOne:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
Administrative Comment by modulo:

All comments and solutions are available to Premium Service Members only. Start your 7-day free trial to view the solution to this question.

Already a member? Login to view this solution.

 
 
20081119-EE-VQP-45