在将数据表与Crystal Report绑定时,我面临排序(排序依据)问题。这是我的查询“通过ID选择SELECT * FROM Payments WHERE(PayDate在@startdate和@enddate之间)的顺序”,查询返回数据表中的排序记录,但是当我将此结果绑定到Crystal Report时,它将变得未排序。请提出解决此问题的方法。
我已经尝试过此代码
DbCommand dbComm = BaseDB.CreatestrCommand();
dbComm.CommandText = "SELECT * FROM Pavti WHERE (PayDate BETWEEN @startdate and @enddate) order by PavtiNo";
//dbComm.CommandText = "SELECT * FROM Pavti WHERE PayDate BETWEEN " + fdt.ToShortDateString() + " and " + tdt.ToShortDateString() + " order by PavtiNo";
DbParameter dbParam = dbComm.CreateParameter();
dbParam.ParameterName = "@startdate";
dbParam.Value = fdt;
dbParam.DbType = DbType.Date;
dbParam.Direction = ParameterDirection.Input;
dbComm.Parameters.Add(dbParam);
dbParam = dbComm.CreateParameter();
dbParam.ParameterName = "@enddate";
dbParam.Value = tdt;
dbParam.DbType = DbType.Date;
dbParam.Direction = ParameterDirection.Input;
dbComm.Parameters.Add(dbParam);
DataTable fieldData;
try
{
fieldData = BaseDB.ExecuteSelect(dbComm);
}
catch (Exception exc)
{
throw exc;
}
return fieldData;
我需要水晶报表中的排序记录
答案 0 :(得分:0)
您的问题在报告中,而不在查询中。使用报表设计器中的报表排序专家来确定要对哪些字段进行排序。