简体   繁体   中英

c# crystal report export error

i have tried to export the crystal report to pdf format. 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..

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?

If you want to construct an MemoryStream obj you need to use something like

MemoryStream memStream = new MemoryStream(100)

Note that MemoryStream implments IDisposable so you probably want to wrap it in a using clause.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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