Skip to Content
author's profile photo Former Member
Former Member

Crystal Reports not showing report on ActionResult MVC3

After trying several options I fail to deploy a report and I am not getting any specific error.

I am developing in Visual Studio 2010 with MVC3 Razor.

I have a view to invoice

This is part of the view:

@model Models.FacturaHeaderModel@{    ViewBag.Title = "Facturación de Compras";    Layout = "~/Views/Shared/_Layout.cshtml";    }@using (Html.BeginForm("Guardar", "Facturas", FormMethod.Post, new { id = "factura" })){    <fieldset>        <div class="editor-label" style="font-size:16px;">            @Html.LabelFor(m => m.Movimiento.DescripLarga)            <div class="editor-field">                @Html.TextBoxFor(m => m.Movimiento.DescripLarga, new { @readonly = "readonly", style = "font-weight: bold;font-size:16px;" })            </div>        </div>....    </fieldset>        <input type="submit" name="Guardar" id="guardar" title="Guardar" value="Guardar" />}

This is part of ActionResult

[AcceptVerbs(HttpVerbs.Post)]public ActionResult Guardar(FacturaHeaderModel model, FormCollection formCollection){            if (ModelState.IsValid)            {..... save data.......                var reporte = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + @"rpt\Factura.rpt";                var rptH = new ReportClass { FileName = reporte };                rptH.Load();                var cnn = new ReportHelper();                cnn.Connect(ref rptH); //connect database                rptH.RecordSelectionFormula = "{CtaCteCliente.CtaCteClienteId}=" + facturaId;                var stream = rptH.ExportToStream(ExportFormatType.PortableDocFormat);                return File(stream, "application/pdf");            }}

For some reason though the report is designed properly and from the designer working properly and after making several attempts to debug the code to detect that is wrong does not seem to be anything unusual.

Some queries:
This error may be caused by the type of response expected by visual studio?

Is there any way to get crystal reports error in previous versions as something like:

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 02, 2013 at 10:06 PM

    The main error is the header of form on the view

    @using (Html.BeginForm("Guardar", "Facturas", FormMethod.Post, new { enctype = "multipart/form-data" }))

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 29, 2013 at 05:08 PM

    When you say:

    This error may be caused...

    Is there an error or are you referring to the report not resulting in an export as an "error"? If there is an actual error, what is it?

    No API along the lines of rptH.LastError ...

    One thing I'd like to suggest; see the KBAs / Notes returned by the search string 'ExportToStream crystal' (search box in top right corner), will help you out. Once the search returns, filter for Notes (right side pane).

    Oh, and I am assuming you are using "SAP Crystal Reports, developer version for Microsoft Visual Studio", Service Pack 6.

    - Ludek

    Senior Support Engineer AGS Product Support, Global Support Center Canada

    Follow us on Twitter

    Got Enhancement ideas? Try the SAP Idea Place

    Share Your Knowledge in SCN Topic Spaces

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.