我有一个数据表,我想将它绑定到fastreport表对象,但它不起作用。我使用C#和visual studio 2015.我的frx文件与我的数据表匹配。我的表对象名称与我的寄存器数据参数匹配。但它仍然无效。请帮助,谢谢大家。 这是我的C#源
using (Report report = new Report())
{
report.Load(@"C:\Users\sevket\Documents\Visual Studio 2015\Projects\OnMuhasebe\OnMuhasebe\bin\Debug\isimsiz.frx"); //Loading frx
DataTable tablo = new DataTable(); //starts my data table
DataColumn sutun; //my columns
sutun = new DataColumn("kod"); //0
tablo.Columns.Add(sutun);
sutun = new DataColumn("cinsi"); //1
tablo.Columns.Add(sutun);
sutun = new DataColumn("miktar"); //2
tablo.Columns.Add(sutun);
sutun = new DataColumn("birimfiyat"); //3
tablo.Columns.Add(sutun);
sutun = new DataColumn("tutar"); //4
tablo.Columns.Add(sutun);
for (int i = 0; i < dgvFaturaListe.Rows.Count - 1; i++)//my datarows
{
DataRow satir;
satir = tablo.NewRow();
satir["kod"] = dgvFaturaListe.Rows[i + 1].Cells[2].Value.ToString();
satir["cinsi"] = dgvFaturaListe.Rows[i + 1].Cells[3].Value.ToString();
satir["miktar"] = dgvFaturaListe.Rows[i + 1].Cells[5].Value.ToString();
satir["birimfiyat"] = dgvFaturaListe.Rows[i + 1].Cells[6].Value.ToString();
satir["tutar"] = dgvFaturaListe.Rows[i + 1].Cells[8].Value.ToString();
tablo.Rows.Add(satir);
i++;
}
report.RegisterData(tablo, "Tablo");// passing table to frx
if (report.Prepare())
{
// Hazırlanmış olan raporun gösterilmesini sağlıyoruz.
report.ShowPrepared();
}
}
这是我的frx tableObject
<TableObject Name="Tablo" Left="94.5" Top="378" Width="708.75" Height="37.8">
<TableColumn Name="kod" Width="94.5"/>
<TableColumn Name="cinsi" Width="302.4"/>
<TableColumn Name="miktar" Width="94.5"/>
<TableColumn Name="birimfiyat" Width="94.5"/>
<TableColumn Name="tutar" Width="122.85"/>
<TableRow Name="Row1">
<TableCell Name="Cell1"/>
<TableCell Name="Cell2"/>
<TableCell Name="Cell3"/>
<TableCell Name="Cell4"/>
<TableCell Name="Cell5"/>
</TableRow>
<TableRow Name="Row2">
<TableCell Name="Cell6"/>
<TableCell Name="Cell7"/>
<TableCell Name="Cell8"/>
<TableCell Name="Cell9"/>
<TableCell Name="Cell10"/>
</TableRow>
</TableObject>