Crystal Report missing data

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2hyaXM=?=, Mar 18, 2005.

  1. I finally got my report to be recongized, that login issue is terrible. Using
    VS.NET 2003, created report inside of it. Now when I attempt to display the
    report is blank (missing data, though I can see the viewer, report fields,
    etc.) I've tried setting the
    rpt.SetDataSource(dstConcernInfo) in the reports VB code behind and my
    viewer code-behind page. No luck. I've displayed my dataset to see that it's
    full. I assume that the report can't see the data? though in VS.NET when I
    created it, it asked for the structue, etc.
    I've searched the C reports knowledge base and the only article I could find
    was about an image issue. My report as no missing images, it's just missing
    the data display???

    Imports CrystalDecisions.Shared
    Imports CrystalDecisions.CrystalReports.Engine
    Imports System.IO
    Imports System.Data.Sqlclient
    Imports System.Data

    Public Class display_qreport
    Inherits System.Web.UI.Page

    Dim crReportDocument As top10bypartnumber = New top10bypartnumber

    Protected WithEvents DropDownList1 As
    System.Web.UI.WebControls.DropDownList
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents CrystalReportViewer1 As
    CrystalDecisions.Web.CrystalReportViewer
    Protected WithEvents Button2 As System.Web.UI.WebControls.Button

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

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form
    Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object
    Private SqlConnect As SqlConnection
    Private ConnectString As String =
    System.Configuration.ConfigurationSettings.AppSettings("connectionString")

    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()

    Dim dstConcernInfo As DataSet
    Dim dadConcernInfo As SqlDataAdapter
    Dim dtConcernInfo As DataTable
    dstConcernInfo = New DataSet
    dadConcernInfo = New SqlDataAdapter("Select * from view_ConcernParts",
    ConnectString)
    dadConcernInfo.Fill(dstConcernInfo, "ConcernInfo")

    ' this is the most IMPORTANT line of code
    ' if this line is not writen the " LOGON FAILED" error starts
    displaying
    crReportDocument.SetDatabaseLogon("qc", "password") ', "server",
    "qualitycenter")

    crReportDocument.SetDataSource(dstConcernInfo)

    ' this will hide the group tree
    CrystalReportViewer1.DisplayGroupTree = False
    CrystalReportViewer1.ReportSource = crReportDocument

    With DropDownList1.Items
    .Add("Rich Text (RTF)")
    .Add("Portable Document (PDF)")
    .Add("MS Word (DOC)")
    .Add("MS Excel (XLS)")
    End With
    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
    End Sub

    Sub ExportReport()

    Dim oStream As New MemoryStream ' // using System.IO

    Select Case DropDownList1.SelectedItem.Text 'this contains the value
    of the selected export format.

    Case "Rich Text (RTF)"

    '--------------------------------------------------------------------

    oStream =
    crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.W
    ordForWindows)
    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/rtf"

    '--------------------------------------------------------------------


    '--------------------------------------------------------------------
    Case "Portable Document (PDF)"

    oStream =
    crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.P
    ortableDocFormat)
    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/pdf"

    '--------------------------------------------------------------------


    '--------------------------------------------------------------------
    Case "MS Word (DOC)"

    oStream =
    crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.W
    ordForWindows)
    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/doc"

    '--------------------------------------------------------------------


    '--------------------------------------------------------------------
    Case "MS Excel (XLS)"

    oStream =
    crReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.E
    xcel)
    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/vnd.ms-excel"

    '--------------------------------------------------------------------
    End Select 'export format
    Try
    Response.BinaryWrite(oStream.ToArray())
    Response.End()
    Catch err As Exception
    Response.Write("< BR >")
    Response.Write(err.Message.ToString)
    End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button2.Click
    ExportReport()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles Button1.Click
    crReportDocument.SetDatabaseLogon("qc", "password", "server",
    "qualitycenter")
    crReportDocument.PrintToPrinter(1, False, 0, 0)
    End Sub
    End Class
    =?Utf-8?B?Q2hyaXM=?=, Mar 18, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. James Wallace
    Replies:
    0
    Views:
    1,040
    James Wallace
    Oct 17, 2003
  2. =?Utf-8?B?SmFpZ2FuZXNo?=

    Reading report content using Crystal Report Viewer XI

    =?Utf-8?B?SmFpZ2FuZXNo?=, Jan 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,162
    =?Utf-8?B?SmFpZ2FuZXNo?=
    Jan 4, 2006
  3. Learner
    Replies:
    1
    Views:
    1,094
    Richard Dudley
    Jan 11, 2006
  4. =?Utf-8?B?QmVu?=

    Crystal Report - No data on report

    =?Utf-8?B?QmVu?=, Apr 5, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    2,185
    =?Utf-8?B?QmVu?=
    Apr 5, 2006
  5. Comfort
    Replies:
    0
    Views:
    539
    Comfort
    Oct 18, 2004
Loading...

Share This Page