1
Answer

LOGON failed in crystal report viewer at run time

asmita patil

asmita patil

9y
816
1


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)