Data outside of band show error CS0103


When I put TextObject in outside a band, Error CS0103: Name 'xxx' do not exists in current context.


for example i have a dataset with three tables, headers_invoice (facturas) ,customers (clientes) , lines_invoices (facturas_lineas)


example:

1. create a dataset named ds
2. fill dataset
3. create a report named rpt
3. register dataset in report rpt.RegisterData(ds,"ds");
4. enabled all tables of dataset ....

foreach (DataTable dt in ds.Tables)
{
rpt.GetDataSource(dt.TableName).Enabled = true;
}

5. Asign data to detail lines of invoice

DataBand banda = rpt.FindObject("BandaLineas") as FastReport.DataBand;
banda.DataSource = rpt.GetDataSource("facturas_lineas");

6. Show the report... as all other reports in my app ...

Note: I don??t use Designer for DATA.. only for desing.


Paste my frx here because i have not right to upload files...


<?xml version="1.0" encoding="utf-8"?>
<Report ScriptLanguage="CSharp" ReportInfo.Created="" ReportInfo.Modified="01/26/2012 22:04:25" ReportInfo.CreatorVersion="1.8.2.0">
<scriptText>using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;

namespace FastReport
{
public class ReportScript
{



}
}
</ScriptText>
<Dictionary>
<Parameter Name="NombreInforme" DataType="System.String"/>
</Dictionary>
<ReportPage Name="Page1">
<PageHeaderBand Name="PageHeader1" Width="718.2" Height="415.8" BeforePrintEvent="PageHeader1_BeforePrint">
<ShapeObject Name="Shape1" Left="311.85" Top="160.65" Width="406.35" Height="160.65"/>
<TextObject Name="Text4" Left="330.75" Top="170.1" Width="378" Height="18.9" Text="[clientes.nombre]" Font="Arial, 10pt, style=Bold"/>
<TextObject Name="Text14" Left="330.75" Top="207.9" Width="378" Height="18.9" Text="[clientes.direccion]"/>
<TextObject Name="Text15" Left="330.75" Top="236.25" Width="94.5" Height="18.9" Text="[clientes.cpostal]"/>
<TextObject Name="Text16" Left="444.15" Top="236.25" Width="264.6" Height="18.9" Text="[clientes.localidad]"/>
<TextObject Name="Text17" Left="330.75" Top="264.6" Width="226.8" Height="18.9" Text="[clientes.provincia]"/>
<ShapeObject Name="Shape2" Top="160.65" Width="302.4" Height="160.65"/>
<TextObject Name="Text18" Left="9.45" Top="170.1" Width="283.5" Height="18.9" Text="DATOS FISCALES:" Font="Arial, 10pt, style=Bold"/>
<TextObject Name="Text19" Left="9.45" Top="207.9" Width="283.5" Height="18.9" Text="[facturas.direccion]"/>
<TextObject Name="Text20" Left="9.45" Top="236.25" Width="94.5" Height="18.9" Text="[facturas.cpostal]"/>
<TextObject Name="Text21" Left="122.85" Top="236.25" Width="170.1" Height="18.9" Text="[facturas.localidad]"/>
<TextObject Name="Text22" Left="9.45" Top="264.6" Width="160.65" Height="18.9" Text="[facturas.provincia]"/>
<TextObject Name="Text23" Left="122.85" Top="292.95" Width="170.1" Height="18.9" Text="[facturas.nif]"/>
<TextObject Name="Text24" Left="9.45" Top="292.95" Width="66.15" Height="18.9" Text="NIF/CIF:"/>
<ShapeObject Name="Shape3" Top="330.75" Width="302.4" Height="37.8"/>
<TextObject Name="Text25" Left="170.1" Top="340.2" Width="113.4" Height="18.9" Text="[facturas.numero]" Font="Arial, 12pt"/>
<TextObject Name="Text26" Left="9.45" Top="340.2" Width="66.15" Height="18.9" Text="Factura:" Font="Arial, 12pt"/>
<TextObject Name="Text27" Left="85.05" Top="340.2" Width="75.6" Height="18.9" Text="[facturas.serie]" Font="Arial, 12pt"/>
<ShapeObject Name="Shape4" Left="311.85" Top="330.75" Width="406.35" Height="37.8"/>
<TextObject Name="Text28" Left="595.35" Top="340.2" Width="103.95" Height="18.9" Text="[facturas.fecha]" Font="Arial, 12pt"/>
<TextObject Name="Text29" Left="321.3" Top="340.2" Width="66.15" Height="18.9" Text="Cliente:" Font="Arial, 12pt"/>
<TextObject Name="Text30" Left="396.9" Top="340.2" Width="75.6" Height="18.9" Text="[facturas.cliente]" Font="Arial, 12pt"/>
<TextObject Name="Text31" Left="491.4" Top="340.2" Width="66.15" Height="18.9" Text="Fecha:" Font="Arial, 12pt"/>
<ShapeObject Name="Shape5" Top="378" Width="718.2" Height="37.8"/>
<TextObject Name="Text32" Left="9.45" Top="387.45" Width="463.05" Height="18.9" Text="Concepto" Font="Arial, 12pt, style=Bold"/>
<TextObject Name="Text33" Left="491.4" Top="387.45" Width="56.7" Height="18.9" Text="Unid." Font="Arial, 12pt, style=Bold"/>
<TextObject Name="Text34" Left="557.55" Top="387.45" Width="66.15" Height="18.9" Text="Precio" Font="Arial, 12pt, style=Bold"/>
<TextObject Name="Text35" Left="633.15" Top="387.45" Width="75.6" Height="18.9" Text="Importe" Font="Arial, 12pt, style=Bold"/>
</PageHeaderBand>
<DataBand Name="BandaLineas" Top="420.29" Width="718.2" Height="18.9" CanGrow="true" CanShrink="true" KeepTogether="true" KeepDetail="true">
<TextObject Name="Text13" Width="472.5" Height="18.9" CanGrow="true" Text="[facturas_lineas.descripcion]" Font="Arial, 9.75pt"/>
<TextObject Name="Text36" Left="491.4" Width="56.7" Height="18.9" CanGrow="true" Text="[facturas_lineas.unidades]" Font="Arial, 9.75pt"/>
<TextObject Name="Text37" Left="557.55" Width="66.15" Height="18.9" CanGrow="true" Text="[facturas_lineas.precio]" Font="Arial, 9.75pt"/>
<TextObject Name="Text38" Left="633.15" Width="75.6" Height="18.9" CanGrow="true" Text="[facturas_lineas.importe]" Font="Arial, 9.75pt"/>
</DataBand>
<ColumnFooterBand Name="ColumnFooter1" Top="443.69" Width="718.2" Height="160.65" PrintOn="LastPage">
<ShapeObject Name="Shape6" Left="481.95" Top="9.45" Width="236.25" Height="151.2"/>
<TextObject Name="Text39" Left="633.15" Top="18.9" Width="75.6" Height="18.9" Text="[facturas.base_exenta]"/>
<TextObject Name="Text40" Left="491.4" Top="18.9" Width="122.85" Height="18.9" Text="Base Exenta:"/>
<TextObject Name="Text41" Left="633.15" Top="47.25" Width="75.6" Height="18.9" Text="[facturas.base_imponible]"/>
<TextObject Name="Text42" Left="491.4" Top="47.25" Width="132.3" Height="18.9" Text="Base Imponible:"/>
<TextObject Name="Text43" Left="491.4" Top="75.6" Width="132.3" Height="18.9" Text="IVA: [facturas.iva_porcentaje] %"/>
<TextObject Name="Text44" Left="633.15" Top="75.6" Width="75.6" Height="18.9" Text="[facturas.iva]"/>
<TextObject Name="Text45" Left="491.4" Top="122.85" Width="132.3" Height="18.9" Text="TOTAL FACTURA" Font="Arial, 10pt, style=Bold"/>
<TextObject Name="Text46" Left="633.15" Top="122.85" Width="75.6" Height="18.9" Text="[facturas.total]"/>
</ColumnFooterBand>
<PageFooterBand Name="PageFooter1" Top="608.83" Width="718.2" Height="28.35">
<TextObject Name="Text3" Left="510.3" Top="9.45" Width="207.9" Height="18.9" Text="P??gina [Page] de [TotalPages]" HorzAlign="Right" Font="Arial, 8pt"/>
</PageFooterBand>
</ReportPage>
</Report>







Comments

  • edited 5:23PM
    Hello,

    CS0103 error may be thrown if you use db column name which does not exists. For example, you trying to print [Table1.MyColumn], but Table1 does not contain such column.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.