Crystal Report Problems


M

Michael Persaud

hello,

i am having problems with loading a crystal report in asp.net, below is the
code, the error message.

for shorts the following is bugging
st = oRpt.FormatEngine.ExportToStream(req)


please help,
its been 2 days now and i cant figure this

Thanks
MP





code
==============================

Dim str As String = "'0','2','7'"
CrystalReportViewer1.ReportSource = Server.MapPath("admin_print.rpt")
If Not Me.IsPostBack Then
Dim Ods As DataSet
Try
oRpt = New ReportDocument
oRpt.Load(Server.MapPath("admin_print.rpt"))
'Ods = dg.DataSource
Ods = getData(str)
'Response.Write(Ods.Tables.Count.ToString)
oRpt.SetDataSource(Ods)
Call ExportToPDF() ' this inititiates the next sub where it fails
Catch oException As Exception
'Throw oException
Response.Write(oException.ToString)
Finally
oRpt.Dispose()
'Ods.Dispose()
'Ods.Clear()
End Try
End If

Private Sub ExportToPDF()
Dim tblCurrent As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent As CrystalDecisions.Shared.TableLogOnInfo
For Each tblCurrent In oRpt.Database.Tables
tliCurrent = tblCurrent.LogOnInfo
With tliCurrent.ConnectionInfo
'get log in info from web.config
..ServerName = ConfigurationSettings.AppSettings("SQLServer")
..DatabaseName = ConfigurationSettings.AppSettings("Database")
..UserID = ConfigurationSettings.AppSettings("UserId")
..Password = ConfigurationSettings.AppSettings("Password")
End With
'apply the log in info
tblCurrent.ApplyLogOnInfo(tliCurrent)
Next tblCurrent

Dim crExportOptions As ExportOptions
Dim st As System.IO.Stream
crExportOptions = oRpt.ExportOptions
With crExportOptions
..FormatOptions = New PdfRtfWordFormatOptions
..ExportFormatType = ExportFormatType.PortableDocFormat
End With
Dim req As ExportRequestContext = New ExportRequestContext
req.ExportInfo = crExportOptions
st = oRpt.FormatEngine.ExportToStream(req)
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Dim b(st.Length) As Byte
st.Read(b, 0, st.Length)
Response.BinaryWrite(b)
End Sub


===============
error stack
===================================
Logon failed.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException:
Logon failed.
 
Ad

Advertisements

S

skg

Looks like your reports are failing to LogIn into the database. Check your
Report to see what userid and password they are using to logon into the
database.
 
Ad

Advertisements

M

Michael Persaud

hello,

thanks

i am using the sa and that password

plus i have a connection string that is creating the dataset and i traced
that to be a workable item

every other call works so why does this one fail?

thanks
MP
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top