crystal report logon error


V

vipindev.s

hi all
i am not much expert in asp.net.
i am using crystal rpt for report generation. is any other report
generation method is available???

i use push method to creat report, and it is working fine, when i
export that report to pdf or xls it generate an error like Logon
failure.

CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.

i use the follwing code for genearting report

Sub BindReport()

Dim myConnection As New SqlClient.SqlConnection

myConnection.ConnectionString = "Password=sa;Persist Security
Info=True;User ID=sa;Initial Catalog=pubs;Data Source=USER"

Dim MyCommand As New SqlClient.SqlCommand

MyCommand.Connection = myConnection

MyCommand.CommandText = "Select * from Stores"

MyCommand.CommandType = CommandType.Text

Dim MyDA As New SqlClient.SqlDataAdapter

MyDA.SelectCommand = MyCommand



Dim myDS As New Dataset1

'This is our DataSet created at Design Time



MyDA.Fill(myDS, "Stores")



'You have to use the same name as that of your Dataset that you
created during design time



Dim oRpt As New CrystalReport1

' This is the Crystal Report file created at Design Time

CType(oRpt.ReportDefinition.Sections(1).ReportObjects(1),
CrystalDecisions.CrystalReports.Engine.TextObject).Color =
Color.CadetBlue


CType(oRpt.ReportDefinition.Sections(1).ReportObjects(1),
CrystalDecisions.CrystalReports.Engine.TextObject).Top = 1


oRpt.SetDataSource(myDS)

' Set the SetDataSource property of the Report to the Dataset



CrystalReportViewer1.ReportSource = oRpt
End Sub



for exporting to pdf i use the following cod on a buton click.
it generate a error at last line " myReport.Export()"

Dim myReport As CrystalReport1 = New CrystalReport1


Dim DiskOpts As
CrystalDecisions.Shared.DiskFileDestinationOptions = New
CrystalDecisions.Shared.DiskFileDestinationOptions


myReport.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile


myReport.ExportOptions.ExportFormatType =
CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat


DiskOpts.DiskFileName = "c:\Output.pdf"


myReport.ExportOptions.DestinationOptions = DiskOpts



how i solve it
any reply is appriciated
thanks in advance
with regards
vipin
 
Ad

Advertisements

P

Praveen

It seems ur missing to set the Datasource property of the report during
post back.
ie we need to again fill the dataset and assign it to the report before
exporting.

Praveen P
 

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