与往常一样,我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
条件,我不知道这是否可能是问题......