Need Help! No data when I export my crystal report into pdf file
Guys,
Can you help me how to debug my codes, I was stuck and i can't find the error why there's no data appeared when i export on pdf file.
DSData as my DATASET
DTR_Report as my Crystal REport
here's my code:
DataOpen()
cmd.CommandText = "Select BIOID, afpsn, Dept, Lname, Fname, CONVERT(char(10), date, 101)Date, Day, AM_IN, AM_OUT, PM_IN, PM_OUT, OT_IN, OT_OUT, DeptHead, DeptPost, TimeLate from AllDTR where BIOID = '" & users & "' AND Date > '08/31/2009' ORDER BY Date"
da = New SqlClient.SqlDataAdapter(cmd.CommandText, cmd.Connection)
ds = New DSDTR
da.Fill(ds, "PrintDTR")
cmd.Connection.Close()
Dim rpt As New ReportDocument
rpt.Load(Server.MapPath("CrystalReports/DTR_Report.rpt"))
rpt.SetDataSource(ds)
Dim expOption As ExportOptions
Dim destination As DiskFileDestinationOptions
Dim Fname As String
Fname = Server.MapPath("App_Data/Temp/" & Session.SessionID.ToString & ".pdf")
destination = New DiskFileDestinationOptions()
destination.DiskFileName = Fname
expOption = rpt.ExportOptions
With expOption
.DestinationOptions = destination
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
rpt.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(Fname)
Response.Flush()
Response.Close()
System.IO.File.Delete(Fname)