When I run my C# windows form application that contains Crystal Report. It's asking me to enter the credential for the MySQL db every time. Even though I entered the correct user name and password. it is saying my user name or password is wrong . I have checked the credential many times and entered password is correct.
Follow this instruction.
TableLogOnInfos TableLogOnInfos = new TableLogOnInfos();
TableLogOnInfo TableLogOnInfo = new TableLogOnInfo();
ConnectionInfo ConnectionInfo = new ConnectionInfo();
Tables Tables;
ConnectionInfo.ServerName = "ServerName";
ConnectionInfo.DatabaseName = "Database";
ConnectionInfo.UserID = "UserId";
ConnectionInfo.Password = "Password";
ReportDocument report = new ReportDocument();
string reportPath = Server.MapPath("~/CrystalReport Path");
report.Load(reportPath);
Tables = report.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in Tables)
{
TableLogOnInfo = table.LogOnInfo;
TableLogOnInfo.ConnectionInfo = ConnectionInfo;
table.ApplyLogOnInfo(TableLogOnInfo);
}
CrystalReportViewer1.RefreshReport();
CrystalReportViewer1.ReportSource = report;
When Report will load in meantime always connection string will set.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.