RobertEB Posted May 12, 2005 Posted May 12, 2005 I have a web page that the user creates a Crystal Report based on the selections they make on the web page. I have the Crystal Report pulling the data from a dataset, then creating a pdf file. It works great on my test machine, but when I move it to the web server, I get this error message; Server Error in '/' Application. -------------------------------------------------------------------------------- Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType). 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: System.MissingMethodException: Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType). Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [MissingMethodException: Method not found: System.IO.Stream CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType).] WorldProjects.SSAB.Button1_Click(Object sender, EventArgs e) +0 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33 System.Web.UI.Page.ProcessRequestMain() +1292 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Here is part of the code I am using; Imports System.IO 'this is at the top of the page 'Below is cut out of a Private Sub Dim SelectedCons As String = "" For Each Itm In CheckBoxList1.Items If Itm.Selected = True Then SelectedCons &= "'" & RTrim(Itm.ToString) & "'," End If Next SelectedCons = SelectedCons.Substring(0, SelectedCons.LastIndexOf(",")) 'Get data Dim SqlStr As String SqlStr = "Select * " & _ "From View_Report02 " & _ "where ShipID=" & ShipID & " AND Destination IN(" & SelectedCons & _ ") " If Dropdownlist3.SelectedItem.ToString <> "" Then If Dropdownlist3.SelectedItem.ToString <> "--Select All--" Then SqlStr &= " AND ArrvlPort='" & ArrvlPort & "' " End If End If SqlStr &= "Order by Destination asc,LoadID desc,MPalletID;" 'Create Dataset Dim SqlDA As New SqlDataAdapter(SqlStr, SqlCon) SqlCon.Open() SqlDA.Fill(DatasetRpt1, "View_Report02") 'DatasetRpt1.WriteXml("testdata.xml") 'DatasetRpt1.WriteXmlSchema("testSchema.xml") SqlCon.Close() 'Populate the report Dim Rep As Report1 Rep = New Report1() Rep.SetDataSource(DatasetRpt1) CrystalReportViewer1.ReportSource = Rep ' Creating the PDF file Dim oStream As New MemoryStream() ' // using System.IO ' oStream = (MemoryStream) oStream = Rep.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat) Response.Clear() Response.Buffer = True Response.ContentType = "application/pdf" Response.BinaryWrite(oStream.ToArray()) Response.End() >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> I am guessing I need to install something on the webserver that has to do with SQLXML. I did install the SQLXML 3.0 and Soap Toolkit 3.0 on the webserver, but that didn't work (I did not reboot after the install because that server is being used by my users) Thank you for any help. Robert Quote
clabarca Posted August 31, 2005 Posted August 31, 2005 Robert, Did you install the Crystal Reports Runtime Engine on the production web server? Crystal reports will not generate if you did not. If you did, then try: Dim oStream As System.IO.Stream oStream = Rep.ExportToStream(ExportFormatType.PortableDocFormat) Response.ClearHeaders() Response.ClearContent() Response.ContentType = "application/pdf" Dim ExpBuffer(ExStream.Length) As Byte ExStream.Read(ExpBuffer, 0, CType(ExStream.Length, Integer)) Response.BinaryWrite(ExpBuffer) Response.End() This code works just fine for me. Cesar Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.