簡體   English   中英

Crystal Reports導出的參數問題

[英]Parameter Problem with Crystal Reports Export

我正在嘗試將Crystal報表導出為pdf,然后通過電子郵件發送給我,但是每當我導出命令時,都會出現ParameterFieldCurrentValue異常。

我已經在ReportDocument中跟蹤了Parameter集合的值,並在那里設置了這些值。 另外,所有四個參數都是字符串。 第一個設置為允許多個值,也可以是離散值或范圍值。 我調用的對話框為該參數的可選選擇設置值。 沒有其他參數字段。 但是,報告中有公式字段。

我的代碼是:

SelectionDialog sd = new SelectionDialog(null, null, 
@"\\er1\common\bfi_apps\ReportMasterTwo\eds\custno.csv", true, false);
DialogResult dr = sd.ShowDialog();
string filename = @"c:\documents and settings\aap\desktop\salesanalysis.pdf";

if (dr == DialogResult.OK && sd.selectedVals != null)
{
    for (int i = 0; i < sd.selectedVals.Count; i++)
    {
        ar100SalesABC_edcustom1.Parameter_Customer_Number.CurrentValues.AddValue
    (sd.selectedVals[i]);
    }

    ar100SalesABC_edcustom1.Parameter_Fiscal_period.CurrentValues.AddValue("1");
    ar100SalesABC_edcustom1.Parameter_Fiscal_year.CurrentValues.AddValue("2007");
    ar100SalesABC_edcustom1.Parameter_Product_Type.CurrentValues.AddValue("F");


    ar100SalesABC_edcustom1.ExportToDisk
    (ExportFormatType.PortableDocFormat, filename); // ERROR HAPPENS HERE

    // .. emailing code and other stuff
}

我究竟做錯了什么? 還有其他更好的方法嗎? 我嘗試了導出選項,我嘗試了SetParameter,但不斷收到該錯誤。

我最終使用SetParameter而不是當前values方法,並且對多值參數使用了values集合。

另外,我沒有使用類型化的報告,而是使用了未類型化的報告文檔。

我還從Crystal Reports復制了sql,並用它來制作數據集。 我認為數據集是我之前缺少的部分。

現在它可以工作,盡管看起來與上面的代碼完全不同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM