troubleshooting Question

Using the .NET Crystal Report Viewer to display a report

Avatar of GaryRasmussen
GaryRasmussenFlag for United States of America asked on
Crystal ReportsC#.NET Programming
21 Comments3 Solutions777 ViewsLast Modified:
I have a bad feeling that I am not going to get any responses to this post but here goes.  The folowing code was working perfectly just 1 month ago and never prompted for a password.  In this example, I have a single report with one database table and no parameters.  When I run this code, the form with the report viewer opens and pops up a small Database Login window with all of the fields populated.  I click Ok and it says:

Login failed.  Please try again.

I re-type the password and it still fails.  I am 100% sure that the credentials are correct and If I run the report in Crystal Reports with the exact same credentials, the report runs as expected.  

The application is running on one machine and the report resides in a folder on the SQL Server.  This is happening with all reports that connect to a database.  I have literaly spent the entire day researching this and have seen many, many posts like this but little or no suggestions and it there are any, they don't work.



ReportDocument reportDoc = new ReportDocument();
reportDoc.Load(fileName);

ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.UserID = userName;
connectionInfo.Password = password;
connectionInfo.ServerName = odbcName;
connectionInfo.DatabaseName = databaseName;
                
foreach (Table table in reportDoc.Database.Tables)
{
  TableLogOnInfo tableLogonInfo = table.LogOnInfo;
  tableLogonInfo.ConnectionInfo = connectionInfo;
  table.ApplyLogOnInfo(tableLogonInfo);
}

crystalReportViewer1.ReportSource = reportDoc;

Open in new window

ASKER CERTIFIED SOLUTION
GlobaLevel
Programmer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 21 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 21 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros