I looked at the forum but none of the steps is not resolving my problem. I have a very simple report connected to SQL Server 2012. When i try to run the report i am getting database prompt. Here is my code
public partial class CrystalForm : System.Web.UI.Page
{
ReportDocument rpt;
protected void Page_Load(object sender, EventArgs e)
{
}
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
ConfigureCrystalReports();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
private void ConfigureCrystalReports()
{
ReportDocument rpt = new ReportDocument();
ArrayList al=new ArrayList();
try
{
rpt.Load(Server.MapPath(@"MatchDetail.rpt"),OpenReportMethod.OpenReportByTempCopy);
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "s09.winhost.com";
connectionInfo.DatabaseName = "DB_54980_njsluggers_user";
connectionInfo.UserID = "DB_54980_njsluggers";
connectionInfo.Password = "Network01";
SetDBLogonForReport(connectionInfo, rpt);
CrystalReportViewer1.ReportSource = rpt;
\
}
catch (Exception)
{
throw;
}
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
}