使用c#导出为pdf时,Crystal REport会在公式字段上抛出错误

时间:2013-05-03 14:00:00

标签: c# asp.net crystal-reports dataset

我有一个基于使用2个表和大约47列的视图构建的水晶报表。这是在cr 2008中创建的。现在我必须将此报告导入到c#asp.net项目中,并使用我创建的数据集作为同一报告的数据源。它给出了一个错误,指出使用视图创建的公式字段会抛出类似这样的错误

This field name is not known.
    Details: errorKindError in File statement {C4B51C11-81BC-4D27-9886-23BE50D5A9D0}.rpt:
    Error in formula  Location: 
    'if {statements_view.DOC_TYPE} = 'RU' then
    {statements_view.BUNUMBER_RU}
    else {statements_view.BUNUMBER}
我在这里错过了什么吗?

这是我到目前为止的代码

string connetionString = null;
OracleConnection connection;
OracleDataAdapter OracleAdapter;
DataSet ds = new DataSet();
string firstSql = null;
string secondSql = null;

connetionString = "DATA SOURCE= blah blah ";
firstSql = "select * from STATEMENT_DOMESTIC";
secondSql = "Select * from STATEMENT_DOM_DETAILS";
connection = new OracleConnection(connetionString);

connection.Open();
OracleAdapter = new OracleDataAdapter(firstSql, connection);
OracleAdapter.Fill(ds, "Tables[0]");
OracleAdapter.SelectCommand.CommandText = secondSql;
OracleAdapter.Fill(ds, "tables[1]");

OracleAdapter.Dispose();
connection.Close();
// GridView1.DataSource = ds;
//  GridView1.DataBind();

ReportDocument reportDoc = new ReportDocument();
reportDoc.Load(@"c:\statement.rpt");
reportDoc.SetDataSource(ds.Tables);

 ExportOptions CrExportOptions;
DiskFileDestinationOptions CrDiskFileDestinationOptions =new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = @"d:\Converte5_1_13.pdf";
CrExportOptions = reportDoc.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;

}
reportDoc.Export();
}

我的数据集存在问题,或者我在这里遗漏了什么 关于这个问题的任何指导都是

0 个答案:

没有答案