I have a reporting services report that was designed in VS2010. When using 'front end' report viewer and sqldatasource the report runs fine. However, I am trying to change the reports datasource and parameters through the 'code behind'. When I run the same report it throws this error 'Illegal characters in path'. So far I have not been able to find a cause. Below is the code behind...
Thanks for any and all assistance!!!
string strConnString = ConfigurationManager.ConnectionStrings["WISCConnectionString"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
getReport();
}
protected void getReport()
{
开发者_如何转开发 DataSet ds = getData();
ReportDataSource rds = new ReportDataSource();
rds.Name = "ParameterCorpBillDate";
rds.Value = ds.Tables["ParameterCorpBillDate"];
rds.DataSourceId = "SqlDataSource1";
ReportViewer1.LocalReport.ReportPath = "Reports\rptPeriodAnalysisCorpBillDate.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();
ReportViewer1.Visible = true;
}
private DataSet getData()
{
DataSet ds = new DataSet();
SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(strConnString);
SqlDataAdapter dataAdapter = new System.Data.SqlClient.SqlDataAdapter();
SqlCommand select = new System.Data.SqlClient.SqlCommand("uspWRPeriodAnalysisCORP_BillDate_noparam");
select.CommandType = CommandType.StoredProcedure;
select.Connection = sqlConnection;
//select.Parameters.Add("@custid", SqlDbType.VarChar).Value = "SON";
//select.Parameters.AddWithValue("@period_startdt", SqlDbType.VarChar).Value = "01/01/2011";
//select.Parameters.AddWithValue("@period_ENDdt", SqlDbType.VarChar).Value = "12/31/2011";
dataAdapter.SelectCommand = select;
dataAdapter.Fill(ds, "ParameterCorpBillDate");
return ds;
}
From previous user assistance... ReportPath = "Reports\rptPeriodAnalysisCorpBillDate.rdlc" – Hans Passant Sep 14 '11 at 21:49
escaping of backslash was over looked...
精彩评论