i have below code for passing parametrs to open crsytal report. But when it opens crystal report i was asking parameters again to show the report.
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables;
cryRpt.Load(Server.MapPath("DMTR1.rpt"));
crConnectionInfo.ServerName = m_strConnectionString.Split(';')[0].Split('=')[1];
crConnectionInfo.DatabaseName = m_strConnectionString.Split(';')[1].Split('=')[1];
crConnectionInfo.UserID = m_strConnectionString.Split(';')[2].Split('=')[1];
crConnectionInfo.Password = m_strConnectionString.Split(';')[3].Split('=')[1];
CrTables = cryRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
{
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
}
cryRpt.SetParameterValue("@ReceivedDate", Convert.ToDateTime("06/21/2013"));
cryRpt.SetParameterValue("@TransferDate", Convert.ToDateTime("08/21/2013"));
crysview.ReportSource = cryRpt;
crysview.RefreshReport();
You need to replace crysview.RefreshReport();
with crysview.DataBind();
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.