I have a report connected to two datasources. A SQL DB and an Oracle DB. I am using a C#.net app to run the reports. In other reports using the same datasources, just one at a time, I can add the logon info and the user never has to enter logon info. How do I do it for two datasources? Here is the code I use for one. I tried just doubling the code, adding a 2 for the second set (instead of crDatabase I used crDatabase2 and so on), and changing the db/password info....but it didn't work. I also tried just entering the info for one DB, hoping to at least set one and only be prompted for one. With both attempts I get an error: "Error in file C:\DOCUME~\....\Temp\temp.......rpt: The table could not be found.
Any suggestions?
*********************************
public class frmOutstandingChecksParam
//Database Authentication
private Database crDatabase;
private Tables crTables;
private Table crTable;
private TableLogOnInfo crTableLogOnInfo;
private ConnectionInfo crConnectionInfo = new ConnectionInfo ();
//End
*********************************
private void btnShow_Click(object sender, System.EventArgs e)
{
crConnectionInfo.ServerName = "acct01";
crConnectionInfo.DatabaseName = "CompanyI";
crConnectionInfo.UserID = "userID";
crConnectionInfo.Password = "Password";
crReportDocument.SetDatabaseLogon("userID","Password");
crDatabase = this.crReportDocument.Database;
crTables = crDatabase.Tables;
for (int i = 0; i < crTables.Count; i++)
{
crTable = crTables ;
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
{
frmOutstandingChecksViewer frm = new frmOutstandingChecksViewer();
frm.vwrOutstandingChecks.ReportSource = crReportDocument;
frm.Show();
}
}
Any suggestions?
*********************************
public class frmOutstandingChecksParam
//Database Authentication
private Database crDatabase;
private Tables crTables;
private Table crTable;
private TableLogOnInfo crTableLogOnInfo;
private ConnectionInfo crConnectionInfo = new ConnectionInfo ();
//End
*********************************
private void btnShow_Click(object sender, System.EventArgs e)
{
crConnectionInfo.ServerName = "acct01";
crConnectionInfo.DatabaseName = "CompanyI";
crConnectionInfo.UserID = "userID";
crConnectionInfo.Password = "Password";
crReportDocument.SetDatabaseLogon("userID","Password");
crDatabase = this.crReportDocument.Database;
crTables = crDatabase.Tables;
for (int i = 0; i < crTables.Count; i++)
{
crTable = crTables ;
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
{
frmOutstandingChecksViewer frm = new frmOutstandingChecksViewer();
frm.vwrOutstandingChecks.ReportSource = crReportDocument;
frm.Show();
}
}