Hello Sir,I want to generate SSRS from Codes that is .rdlc extension files Please rectify my code I used in my page.DataTable dt = new DataTable(); dt=Tray.fillProjects(); try { if (dt.Rows.Count > 0) { ReportDocument rptdoc = new ReportDocument(); rptdoc.Load(Server.MapPath("~\\Reports\\Tremor.rdlc")); rptdoc.SetDataSource(dt); crv.ReportSource = rptdoc; crv.DataBind(); ExportOptions exportOpts1 = rptdoc.ExportOptions; rptdoc.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rptdoc.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; rptdoc.ExportOptions.DestinationOptions = new DiskFileDestinationOptions(); ((DiskFileDestinationOptions)rptdoc.ExportOptions.DestinationOptions).DiskFileName = Server.MapPath("Tremor.pdf"); rptdoc.Export(); rptdoc.Close(); rptdoc.Dispose(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=Tremor.pdf"); Response.WriteFile("Tremor.pdf"); Response.Flush(); Response.Close(); System.IO.File.Delete(Server.MapPath("Tremor.pdf")); } else { Page.ClientScript.RegisterStartupScript(this.GetType(),"Hello","javascript:alert('ok');",true); } } catch { } }I debug this code When it reached to path that I have given above i.e. "~\\Reports\\Tremor.rdlc" it reaches to catch and throws exception Load Report failedPlease Guide me 解决方案 这篇关于如何使用代码生成SSRS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-21 09:27