G
Guest
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
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