crystal report有兩個參數字段,但是,我用了三種搜索方法,都失敗了。 錯誤缺少參數值。如何將參數傳遞給水晶報表?
確保參數是通過標籤
但檢查查詢字符串 http://localhost:1604/Cheques/viewReport.aspx?type=TT&ID=5&tCOMDB=Project_TR_TP_COM_Test 路過,不知道爲什麼錯誤缺少參數值。
方法1
// First parameter
ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = Request.QueryString["ID"];
crParameterFieldDefinitions = objRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Cheque_IssueRecord_Secretary_Review_TT_ID"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
// Second parameter
ParameterFieldDefinitions crParameterFieldDefinitions2;
ParameterFieldDefinition crParameterFieldDefinition2;
ParameterValues crParameterValues2 = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue2 = new ParameterDiscreteValue();
crParameterDiscreteValue2.Value = Request.QueryString["tCOMDB"];
crParameterFieldDefinitions2 = objRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition2 = crParameterFieldDefinitions2["tCOMDB"];
crParameterValues2 = crParameterFieldDefinition2.CurrentValues;
crParameterValues2.Clear();
crParameterValues2.Add(crParameterDiscreteValue2);
crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2);
方法2
//objRpt.SetParameterValue("Cheque_IssueRecord_Secretary_Review_TT_ID", Request.QueryString["ID"]);
//objRpt.SetParameterValue("tCOMDB", Request.QueryString["tCOMDB"]);
方法3
var value = new ParameterDiscreteValue();
value.Value = Request.QueryString["ID"];
objRpt.ParameterFields["Cheque_IssueRecord_Secretary_Review_TT_ID"].CurrentValues.Add(value);
var value2 = new ParameterDiscreteValue();
value2.Value = Request.QueryString["tCOMDB"];
objRpt.ParameterFields["tCOMDB"].CurrentValues.Add(value2);
存儲過程此晶體報告數據庫使用, 參數字段被自動添加,之後加入我刪除@字符 不知道爲什麼缺少參數
p沒有名稱和當前值屬性 – Jo0o0 2011-03-10 04:01:57
我改變parameterfield – Jo0o0 2011-03-10 04:03:48
嘗試失敗 – Jo0o0 2011-03-10 04:05:48