Crystal Report Display Only First row RRS feed

  • Question

  • User1119347574 posted


    When my procedure returns more than one row...but on field section of my crystal rport it displaying only the first row.....why it is not showing all the rows

    weather we need to change any setting for this........urgent help me............

    Friday, September 13, 2013 11:09 PM

All replies

  • User2103319870 posted


    Please try the solution suggested in below link


    Friday, September 13, 2013 11:36 PM
  • User1119347574 posted

    Hi No use after reading that............same issue for me

    Saturday, September 14, 2013 12:08 AM
  • User1143442848 posted


    According to your description, the crystal report only displayed the first row but the procedure returned more than one row.

    Firstly, I suggest you set a breakpoint to check if the stored procedure returns the right DataSet or not and the one row showed in the report is included in the DataSet or not.

    Secondly, please try to refer to the code snippet below and I think you will find the solution. Note: the code is in vb.net, but it can easily be converted to C#.

    Imports CrystalDecisions.CrystalReports.Engine
     Imports CrystalDecisions.Shared
     Imports System.Data
     Imports System.Data.SqlClient
    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
         End Sub
    Private Sub ConfigureReport()
             If Not Page.IsPostBack Then
                 Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()
                 myConnectionInfo.DatabaseName = DatabaseName
                 myConnectionInfo.UserID = userid
                 myConnectionInfo.Password = password
                 Dim ReportPath As String = Server.MapPath("YourReport.rpt")
                 ReportViewer1.ReportSource = ReportPath
                Dim field1 As ParameterField = Me.ReportViewer1.ParameterFieldInfo(0)
                 Dim field2 As ParameterField = Me.ReportViewer1.ParameterFieldInfo(1)
                 Dim val1 As New ParameterDiscreteValue()
                 Dim val2 As New ParameterDiscreteValue()
                 val1.Value = "value1"
                 val2.Value = "value2"
             End If
     End Sub
    Private Sub SetDBLogonForReport(ByVal myConnectionInfo As ConnectionInfo)
             Dim myTableLogOnInfos As TableLogOnInfos = ReportViewer1.LogOnInfo()
             For Each myTableLogOnInfo As TableLogOnInfo In myTableLogOnInfos
                 myTableLogOnInfo.ConnectionInfo = myConnectionInfo
         End Sub

    More explaination about the code please try to refer to the link below:

    # Connecting a stored procedure to a crystal report



    Here is an article about using stored procedures to create crystal report:

    # using stored procedures to create crystal report



    If you need more assistance, please feel free to let me know. 

    If possible, please try to post some more information in order to get more supports in a better way.

    Best Regards,

    Lisa Zhang

    Sunday, September 15, 2013 10:42 PM
  • User1786833724 posted

    Please make sure that you're sticking the fields are in details and not in headers section. Please have a look at these screen shots :


    You may want to put  a breakpoint when you're getting results to make sure that the query does return the results

    protected void Page_Load(object sender, EventArgs e)
    			DataTable tblOrderDetail = new DataTable("OrderDetail");
    			SqlCommand commnad = new SqlCommand("[dbo].[CustMultiOrdersDetail]");
    			commnad.CommandType = CommandType.StoredProcedure;
    			commnad.Parameters.Add(new SqlParameter("OrderID", "10643,10692,10702,10835,10952"));
    			ReportHelper.GetQueryResultFromNorthwind(ref commnad, ref tblOrderDetail);
                            //breakpoint on next line to see if 'tblOrderDetail' has got value
    			CrystalReport1 objReport = new CrystalReport1();
    			ReportDocument doc = new ReportDocument();
    			CrystalReportViewer1.ReportSource = objReport;
    			//objReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Page.Response, true, "Test PDF.pdf");
    			objReport.ExportToDisk(ExportFormatType.PortableDocFormat, "C:\\Data\\Testy.pdf");

    Monday, September 16, 2013 2:05 AM