Click here to Skip to main content
15,895,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

The crystal report database login page still popup even after providing the credentials in the code.My code is as below

OpenFileDialog file = new OpenFileDialog();
            file.Filter = "Report Files (*.rpt)|*.rpt";
            if (file.ShowDialog() == DialogResult.OK)
            {
                report_file = (string)file.FileName;
            }
            //setDatabaseSettings();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables CrTables;
            ReportDoc.Load(report_file);
            crConnectionInfo.ServerName = "XYZPC\\XYZ";
            crConnectionInfo.DatabaseName = "RME01";
            crConnectionInfo.UserID = "sa";
            object pwd = "123";
            crConnectionInfo.Password.Equals(pwd);
            CrTables = ReportDoc.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }
            crystalReportViewer1.ReportSource = ReportDoc;
            crystalReportViewer1.Refresh();


Please help
Posted
Updated 24-Apr-11 15:39pm
v2
Comments
HimanshuJoshi 24-Apr-11 21:40pm    
Added pre tags around code.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900