简体   繁体   English

C#Crystal Report导出错误

[英]c# crystal report export error

i have tried to export the crystal report to pdf format. 我试图将水晶报表导出为pdf格式。 but i go the error like 'System.IO.MemoryStream' is a 'type' but is used like a 'variable'..... ANd this is my code, please verify it and correct me.. 但是我遇到类似“ System.IO.MemoryStream”是“类型”但却像“变量”那样使用的错误.....这是我的代码,请验证并更正我。

protected void Button1_Click(object sender, EventArgs e)
    {
        MemoryStream MS;
        MS = (MemoryStream);
        MR.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/pdf";
        Response.BinaryWrite(MS.ToArray());
        Response.End();


    }

The issue is the line 问题是线

MS = (MemoryStream);

You seem to be missing something here. 您似乎在这里错过了一些东西。 Are you trying to cast something to memorystream, if so what? 您是否正在尝试将某些内容投射到memorystream,如果是的话?

If you want to construct an MemoryStream obj you need to use something like 如果要构造一个MemoryStream obj,则需要使用类似

MemoryStream memStream = new MemoryStream(100)

Note that MemoryStream implments IDisposable so you probably want to wrap it in a using clause. 请注意,MemoryStream实现了IDisposable,因此您可能希望将其包装在using子句中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM