on 08-29-2013 12:18 AM
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
The main error is the header of form on the view
@using (Html.BeginForm("Guardar", "Facturas", FormMethod.Post, new { enctype = "multipart/form-data" }))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.