cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports not showing report on ActionResult MVC3

Former Member
0 Kudos

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:

rptH.LastError

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The main error is the header of form on the view

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

Answers (1)

Answers (1)

former_member183750
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Only mean that it is wrong because crystal reports is not exporting anything.


I'll try what you mentioned and then back to update my question

Former Member
0 Kudos

I install the sdk version 6 crystal reports in this image is all available information

Any idea how to diagnose my problem.