Q:

Crystal report and parameter through querystring

This is in my html:
<CR:CrystalReportViewer ID="CrystalReportViewer1"  runat="server" AutoDataBind="true" />

and this is the load code:
ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(Server.MapPath("/reports/Mat-new.rpt"));

cryRpt.SetParameterValue("PO", Request.QueryString["po"]);
cryRpt.SetParameterValue("MR", Request.QueryString["mr"]);

CrystalReportViewer1.ReportSource = cryRpt;
CrystalReportViewer1.RefreshReport();

var mytableloginfos = new TableLogOnInfos();
var myConnectionInfo = new ConnectionInfo();

mytableloginfos = CrystalReportViewer1.LogOnInfo;
foreach (TableLogOnInfo myTableLogOnInfo in mytableloginfos)
{
    myTableLogOnInfo.ConnectionInfo = myConnectionInfo;
}

myConnectionInfo.ServerName = "opl";
myConnectionInfo.DatabaseName = "FIL";
myConnectionInfo.UserID = "rep";
myConnectionInfo.Password = "rep";

For the life of my, cant get the parameters to pass.
Any idea how i can get this working?

A:

Try this:
private void PassParameters()
{
 string po =  Request.QueryString["po"];
 string mr = Request.QueryString["mr"]

 ParameterValues ppo = new ParameterValues();
 ParameterValues pmr = new ParameterValues();

 ppo.AddValue(po);
 pmr.AddValue(mr);

 foreach (ParameterField field in cryRpt.ParameterFields)
 {
   if (string.Compare(field.Name.TrimStart('@'), "PO", true) == 0)
      field.CurrentValues = ppo;

   if (string.Compare(field.Name.TrimStart('@'), "MR", true) == 0)
      field.CurrentValues = pmr;

  }

