// Create a new instance of the tablelogoninfos class which contains
//the tablelogoninfo objects for each table in the report
crTableLogonInfos = new TableLogOnInfos();
//Create a new instance of the TableLogonInfo class which contains
//the connection information for each table
crTableLogonInfo = new TableLogOnInfo();
//Set the connection properties
//Note: this sample report connects to the SQL Server sample Pubs database
//If you have access to SQL server, enter in your values for the ServerName,
//UserID and Password properties to connect. The report included with this
//sample application connects using OLE-DB and SQL authentication.
crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "rcon1";
crConnectionInfo.DatabaseName = "Pubs";
crConnectionInfo.UserID = "vantech";
crConnectionInfo.Password = "vantech";
//apply the connection information to each table. If the TableName is not specified, the
//logon to the database will fail. Once the tablename and connection information have been
//set for each table object, it is added to the TableLogonInfos collection using the Add method.
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTableLogonInfo.TableName = "authors";
crTableLogonInfos.Add(crTableLogonInfo);
//Pass the table information to the logoninfo property of the viewer
CrystalReportViewer1.LogOnInfo = crTableLogonInfos;