FastReport脚本把数据绑定到文本控件上
public class ReportScript
{
private void Data25_BeforePrint(object sender, EventArgs e)//Data25是指需要绑定数据源的控件
{
DataSourceBase data1 = Report.GetDataSource("VW_Rpt_CorpQualifition"); // 获取数据源
data1.Init(); // 初始化
string mainQualifition=string.Empty;
string detailQualifition=string.Empty;
while(data1.HasMoreRows) // 打印重复循环的行
{
string name = (string)Report.GetColumnValue("VW_Rpt_CorpQualifition.FC_CertName");
int isMain = (int)Report.GetColumnValue("VW_Rpt_CorpQualifition.FN_IsMain");
if(isMain == 1 )
{
mainQualifition += name + ","; //主项资质
}
else
{
detailQualifition += name + ","; //增项资质
}
data1.Next(); // 读取下一行
}
MainQualifition.Text =mainQualifition.TrimEnd(',');
DetailQualifition.Text =detailQualifition.TrimEnd(',');
}
}