title: crystal report Unable to connect: incorrect log on parameters
body: <p>Hi friend I've created a crystal report with parameter,its running successfully in while executing in source code but it does not load in while i config after IIS its shows the error like unable to connect log on parameters. Please check my code and correct me.</p>
  
  <p>hi frinds if i comment the  oStream = (MemoryStream)reportdocument.ExportToStream(ExportFormatType.PortableDocFormat); this line and  Response.BinaryWrite(oStream.ToArray()); this report is generate in IIS but i not get in proper pdf formate pls help me i want to generate in pdf formate pls guide me</p>
  
  <pre><code>public partial class frm_MRPrint : System.Web.UI.Page
  {
      SqlConnection Con = new SqlConnection(ConfigurationManager.AppSettings["conn"].ToString());
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
              mr();
          }
      }
      protected void Button1_Click(object sender, EventArgs e)
      {
  
          MemoryStream oStream;
          Response.Clear();
          Response.Buffer = true;
  
  
          ReportDocument reportdocument = new ReportDocument();
  
          reportdocument.Load(Server.MapPath("MR.rpt"));
          reportdocument.SetDatabaseLogon("sa", "Admin123", "vivek", "PURCHASE");
  
          reportdocument.SetParameterValue("MRNO", ddlmrno.SelectedItem.Text);
  
          CrystalReportViewer1.ReportSource = reportdocument;
  
          oStream = (MemoryStream)reportdocument.ExportToStream(ExportFormatType.PortableDocFormat);
          Response.ContentType = "application/pdf";
          try
          {
  
              //write report to the Response stream
  
              Response.BinaryWrite(oStream.ToArray());
  
              Response.End();
  
          }
  
          catch (Exception ex)
          {
              Label2.Visible = true;
              Label2.Text = "ERROR:" + Server.HtmlEncode(ex.Message.ToString());
  
  
          }
  
          finally
          {
  
              //clear stream
  
              oStream.Flush();
  
              oStream.Close();
  
              oStream.Dispose();
  
          }
  
          //in case you want to export it as an attachment use the line below
  
          //crReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Your Exported File Name");
  
      }
  
      public void mr()
      {
  
          ddlmrno.Items.Clear();
          ListItem frstitem = new ListItem();
          frstitem.Text = "- Select -";
          ddlmrno.Items.Add(frstitem);
          ddlmrno.SelectedIndex = 0;
          Con.Open();
          string sql = "";
          sql = "select  distinct(MRNO) from dbo.tbl_KKSMR where status=1 order by MRNO asc";
          SqlCommand cmd = new SqlCommand(sql, Con);
          SqlDataReader rdr;
          try
          {
              rdr = cmd.ExecuteReader();
              while (rdr.Read())
              {
  
                  ListItem newItem = new ListItem();
                  newItem.Text = rdr["MRNO"].ToString().Trim();
                  newItem.Value = rdr["MRNO"].ToString().Trim();
                  ddlmrno.Items.Add(newItem);
              }
              rdr.Close();
          }
          catch (Exception ex)
          {
              Response.Write(ex.Message);
          }
          finally
          {
              cmd.Dispose();
  
          } Con.Close();
  
      }
  }
  </code></pre>