asmita patil

asmita patil

  • NA
  • 22
  • 11.3k

LOGON failed in crystal report viewer at run time

Feb 6 2015 2:02 AM


why this error will be showing

Logon failed in crystal report viewer at run time

here is my code..


 private void button1_Click(object sender, EventArgs e)
        {
          
              
                ReportDocument cryRpt = new ReportDocument();
                TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
                TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
                ConnectionInfo crConnectionInfo = new ConnectionInfo();
                Tables CrTables;

              
                cryRpt.Load(@"G:\6th sem\crystal2_try\crystal2_try\CrystalReport1.rpt");

                crConnectionInfo.ServerName = "IDEA-PC\\SQLEXPRESS";
                crConnectionInfo.DatabaseName = "SVK_DATABASE.MDF";
                crConnectionInfo.UserID = "USER";
                crConnectionInfo.Password = "PASS";

                CrTables = cryRpt.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
                {
                    crtableLogoninfo = CrTable.LogOnInfo;
                    crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                    CrTable.ApplyLogOnInfo(crtableLogoninfo);
                }

                crystalReportViewer1.ReportSource = cryRpt;
                crystalReportViewer1.Refresh();
            }
           

        }

Answers (1)