Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Viewer in C#

Status
Not open for further replies.

bddsolid

Programmer
Jul 20, 2004
19
BE
Hi,

We wrote a Crystal Reports Viewer in C#. The viewer works very well if we use only tables in our reports. If we use Commands, we get a logon screen. Of course we don't want that.
We reset the the data source for each table, but it don't work apperently for Commands.
This is the code that I use to reset the data source:
Code:
		static private ReportDocument LoadReport(String reportLocation)
		{
			//ReportDocument document = new ReportDocument();
			document.Load(reportLocation);

			foreach (Table table in document.Database.Tables)
			{
				// Get the TableLogOnInfo object.
				CrystalDecisions.Shared.TableLogOnInfo logonInfo = table.LogOnInfo;

				// Set the server or ODBC data source name, database name, 
				// user ID, and password.
				logonInfo.ConnectionInfo.ServerName = serverName;
				logonInfo.ConnectionInfo.DatabaseName = databaseName;
				logonInfo.ConnectionInfo.UserID = user;
				logonInfo.ConnectionInfo.Password = password;
									
				// Apply the connection information to the table.
				table.ApplyLogOnInfo(logonInfo);

				table.Location = table.Location;
				
				
			}
		}

What can be the problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top