Crystal Report Error: Database Logon failed in ASP.Net

Last Reply 29 days ago By dharmendr

Posted one month ago

I don't know why crystal report is not shown in browser?

I got error: database logon failed massage

using System.Web.UI.WebControls; //Crystal Report Namespaces 
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace CRTest
{
    public partial class Default : System.Web.UI.Page
    {
        CrystalReportTest rpt;
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void Page_Init(object sender, EventArgs e)
        {

            if (Session["report"] != null)
            {
                CrystalReportViewer1.ReportSource = (CrystalReportTest)Session["report"];
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {//looks 2 part CRDataset and ApplicantInfoKTableAdapter in CRDataset.xsd

            //namespace CRTest.CRDataSetTableAdapters +public partial class ApplicantInfoKTableAdapter
            CRDataSetTableAdapters.ApplicantInfoKTableAdapter da = new CRDataSetTableAdapters.ApplicantInfoKTableAdapter();
            CRDataSet ds = new CRDataSet();
            //database+table name
            CRDataSet.ApplicantInfoKDataTable dt = (CRDataSet.ApplicantInfoKDataTable)
            ds.Tables["ApplicantInfoK"];
            da.Fill(dt);
            rpt = new CrystalReportTest();
            rpt.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = rpt;
            Session.Add("report", rpt);
            CrystalReportViewer1.RefreshReport();

        }
    }
}
Posted 29 days ago

Hi KatieNgoc,

Looks like it is Database Login issue.

Make sure that the Server Name, Database Name, UserName and Password is correct.