Crystal Report Problem Please help!!! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Crystal Report Problem Please help!!!

kingter22kingter22 Posts: 2Member
[b][red]This message was edited by kingter22 at 2004-12-10 13:35:44[/red][/b][hr]
Hi Guys,

I am trying to export my crystal report to PDF.. It is successful BUT.... THERE IS NO DATA (I think thats what I need).
I have the log ons and the parameters set as well but still no data is there something wrong in my code that I don't know about? Please help...

by the way, the data is coming from a dataset.

myreport = New ReportDocument()
myreport.Load("C:InetpubwwwrootOWLClass_ReportClassRpt.rpt")
fname = "D:Schemas est.pdf"
crdiskfiledest = New DiskFileDestinationOptions()
crdiskfiledest.DiskFileName = fname

crdef = myreport.DataDefinition
pfdef = crdef.ParameterFields
pfs = Me.CrystalReportViewer1.ParameterFieldInfo

pf1 = pfs(0)
pf2 = pfs(1)
pf3 = pfs(2)
pv1 = pf1.CurrentValues
pv2 = pf2.CurrentValues
pv3 = pf3.CurrentValues

myreport.DataDefinition.ParameterFields(0).ApplyCurrentValues(pv1)
myreport.DataDefinition.ParameterFields(1).ApplyCurrentValues(pv2)
myreport.DataDefinition.ParameterFields(2).ApplyCurrentValues(pv3)


crexportoptions = myreport.ExportOptions
With crexportoptions
.DestinationOptions = crdiskfiledest
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With

Dim mytable As DataTable

Dim i As Integer
For i = 0 To myreport.Database.Tables.Count - 1
cr = myreport.Database.Tables(i).LogOnInfo
cr.ConnectionInfo.UserID = "dbuser"
cr.ConnectionInfo.Password = "user"
myreport.Database.Tables(i).ApplyLogOnInfo(cr)

Next

myreport.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.Write(fname)
Response.Flush()
Response.Close()



Sign In or Register to comment.