与往常一样,我正在使用ReportViewer
,这是第一次将so long
重新定位。
这里的任何人都可以告诉我可能是什么?
这是代码,显示我如何喂养reportviewer
ReportParameter param = new ReportParameter("USR", usr);
ReportViewer1.LocalReport.SetParameters(param);
ReportViewer1.LocalReport.ReportPath = "MyReport.rdlc";
DataSet ds = _rel.FeedDS(rel);
ReportDataSource rds = new ReportDataSource("my_ds", ds.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.DataBind();
ReportViewer1.LocalReport.Refresh();
paineel.Visible = true;
ReportViewer1.Width = 640;
public DataSet FeedDS(Reports rel)
{
rel.Dt_Inicial += " 00:00:00";
rel.Dt_Final += " 23:59:59";
DataSet retorno = new DataSet();
string sql = @"SELECT proj.descricao AS projeto, func.descricao AS funcionalidade, clb.clube AS cliente, ch.descricao
FROM mytable ch
INNER JOIN projetos proj ON ch.projeto = proj.id
INNER JOIN funcionalidades func ON ch.funcionalidade = func.id
INNER JOIN clubes clb ON ch.clube = clb.id
WHERE ch.dt_cadastro BETWEEN @dt_inicial AND @dt_final";
MySqlCommand cmd = new MySqlCommand();
cmd.CommandType = CommandType.Text;
try
{
cmd.CommandText = sql;
cmd.Parameters.Add(new MySqlParameter("@dt_inicial", MySqlDbType.DateTime)).Value = rel.Dt_Inicial;
cmd.Parameters.Add(new MySqlParameter("@dt_final", MySqlDbType.DateTime)).Value = rel.Dt_Final;
retorno = _dal.Consultar(cmd);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return retorno;
}
Obs:在我dataset
方法中,在FeedDS
方法中,我有7个IFs/Elses
条件,我不知道这是不是问题...