title: Crystal Report Viewer - Logon prompt
body: <p>I have some Crystal Reports off a customer which I need to link to an ASP.NET application we are creating. I have the following code:</p>
  
  <pre><code> LINQDataContext dc = new LINQDataContext();
          Order o = dc.Orders.Where(a =&gt; a.ID == long.Parse(Request.QueryString["OrderID"])).Single();
          SqlConnectionStringBuilder bld = new SqlConnectionStringBuilder(dc.Connection.ConnectionString);
          CrystalReportSource src = new CrystalReportSource();
          src.ID = "test";
          ConnectionInfo myConnectionInfo = new ConnectionInfo();
  
          myConnectionInfo.ServerName = bld.DataSource;
          myConnectionInfo.DatabaseName = bld.InitialCatalog;
          myConnectionInfo.UserID = bld.UserID;
          myConnectionInfo.Password = bld.Password;
  
          src.Report.FileName = o.SalesPersonObject.GetType().GetProperty(Request.QueryString["DeliveryNoteType"]).GetValue(o.SalesPersonObject, null).ToString();
  
  
          ParameterDiscreteValue param = new ParameterDiscreteValue();
          param.Value = long.Parse(Request.QueryString["OrderID"]); 
          src.ReportDocument.ParameterFields[0].CurrentValues.Add(param); 
  
          CrystalReportViewer vw = new CrystalReportViewer();
          src.ReportDocument.SetDatabaseLogon(bld.UserID, bld.Password);
          vw.HasToggleGroupTreeButton = false;
          vw.AutoDataBind = true;
          vw.Height = 1268;
          vw.Width = 1000;
          vw.HasPrintButton = true;
          vw.PrintMode = PrintMode.Pdf;
          vw.ReportSource = src;
          //vw.EnableDatabaseLogonPrompt = false;
          vw.HasToggleParameterPanelButton = false;
          vw.HasCrystalLogo = false;
          vw.RefreshReport();
          plcReport.Controls.Add(vw);
  </code></pre>
  
  <p>However, even though I'm setting the username/password using the SetDatabaseLogon method, I'm still getting a prompt to enter the database login details, or more specifically to enter the password. I've tried using vw.EnableDatabaseLogonPrompt = true, but that gives me a database login issue.</p>
  
  <p>Any ideas?</p>