使用带有IN子句的Crystal Reports中的RecordSelectionFormula

时间:2012-10-08 12:54:05

标签: c# crystal-reports-xi

当我使用RecordSelectionFormula属性将以下内容传递给Crystal Report时,无法生成错误“The)”。这是一个有效的Where子句,只是不确定如何在Crystal Reports XI中使用它。

SelectionFormula = "({vInventory_Items.DonorId} IN (8, 1))";
Report.ReportSelectionFormula = SelectionFormula;

错误是;

Error in formula  Record_Selection: 
'({vInventory_Items.DonorId} IN (8, 1))'
The ) is missing.

1 个答案:

答案 0 :(得分:0)

我使用了以下内容并解决了我的问题;

DataTable dtRawData = new DataTable();
SqlConnection loConn = ConnectionUtilities.getServerConnection();
loConn.Open();
SqlDataAdapter sdaSysObjects = new SqlDataAdapter(psSqlStatement, loConn);
sdaSysObjects.Fill(dtRawData);
Report.SetDataSource(dtRawData);