Hi All,
May I know, what are the correct doce should i add in for
//DataTable dt = GetData(txt_projectid.ToString());
DataTable dt = GetData("2B3BC115-9E82-E511-8DC5-989096D1BA09");
my textbox is txt_projectid.text
private void ShowReport()
{
//reset
rptViewer.Reset();
//Datasource
//DataTable dt = GetData(txt_projectid.ToString());
DataTable dt = GetData("2B3BC115-9E82-E511-8DC5-989096D1BA09");
ReportDataSource rds = new ReportDataSource("DataSet1", dt);
rptViewer.LocalReport.DataSources.Add(rds);
//Path
rptViewer.LocalReport.ReportPath = "Report.rdlc";
//Parameters
ReportParameter[] rptParams = new ReportParameter[] {
new ReportParameter("ProjectID",txt_projectid.Text)
};
rptViewer.LocalReport.SetParameters(rptParams);
//Refresh
rptViewer.LocalReport.Refresh();
}
private DataTable GetData(string StrProjectID)
{
DataTable dt = new DataTable();
string connStr = System.Configuration.ConfigurationManager.ConnectionStrings["EPMSReportsDBConnectionString"].ConnectionString;
using (SqlConnection cn = new SqlConnection(connStr))
{
SqlCommand cmd = new SqlCommand("GetProjectDetails", cn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Project_ID", SqlDbType.VarChar).Value = StrProjectID;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(dt);
}
return dt;
}