Hi All,
I am developing a web aplication where I can generate the reports and export them into PDF and save it on my hard drive. All my reports are saved on the hard disk and i just call the report that i need to be generated programatically. I have no problem in generating the reports some reports. But the reports that need a stored procedure to be executed do not work. Can anybody please tell me why this is happening.
I am pasting my code down here.
Dim oraConn As OleDbConnection
oraConn = New OleDbConnection("Provider=MSDAORA.1;Data Source=ikaclaim;User Id=cs_admin;Password=cs_admin;")
Dim oraCmd As OleDbCommand
oraCmd = New OleDbCommand("PROC_ROLL_MEM_MONTH", oraConn)
oraCmd.CommandType = CommandType.StoredProcedure
oraCmd.Parameters.Add(New OleDbParameter("@date1", OleDbType.Date, 9)).Value = "01-Jan-2001"
oraCmd.Parameters.Add(New OleDbParameter("@date2", OleDbType.Date, 9)).Value = "31-Dec-2001"
oraConn.Open()
oraCmd.ExecuteNonQuery()
oraConn.Close()
lblEx.Text = "Data Set Success"
Dim rdS1 As ReportDocument
Dim crEO1 As ExportOptions
Dim dfdo1 As DiskFileDestinationOptions
Dim fname1 As String
rdS1 = New ReportDocument
Dim repPath1 As String
repPath1 = "D:\Projects\IKA-VBP\reports\" & Session("rptName") & ".rpt"
rdS1.Load(repPath1)
fname1 = "d:\Reports-IKA\Exports\" & Session.SessionID.ToString & ".pdf"
dfdo1 = New DiskFileDestinationOptions
dfdo1.DiskFileName = fname1
crEO1 = rdS1.ExportOptions
With crEO1
.DestinationOptions = dfdo1
.ExportDestinationType() = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
End With
' I am getting an error when I try to execute this line
'of code.
rdS1.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(fname1)
Response.Flush()
Response.Close()
the error looks something like this.
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.DataSourceE xception: Query Engine Error: 'D:\Projects\IKA-VBP\reports\RollingMember-View.rpt'
Source Error:
Line 121: .ExportFormatType = ExportFormatType.PortableDocFormat
Line 122: End With
Line 123: rdS1.Export()
Line 124: Response.ClearContent()
Line 125: Response.ClearHeaders()
Source File: D:\Projects\IKA-VBP\trial_param.aspx.
vb Line: 123
Stack Trace:
[DataSourceException: Query Engine Error: 'D:\Projects\IKA-VBP\reports\RollingMember-View.rpt']
.F(String , EngineExceptionErrorID
)
.A(Int16 , Int32 )
.@(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export(ExportRequestContext reqContext)
CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export()
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.Export()
IKA_VB.trial_param.Page_Load(Object sender, EventArgs e) in D:\Projects\IKA-VBP\trial_param.aspx.
vb:123
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731
Any help will be greatly appreciates. Thanks in advance
Regards,
Kalyan Bobba