G
Guest
I'm not sure why this is happening. I'm trying to run a late-bound report.
My original code looked like this:
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
logOnInfo.ConnectionInfo.ServerName = "<server name>";
logOnInfo.ConnectionInfo.DatabaseName = "<dbname>";
logOnInfo.ConnectionInfo.UserID = "<user id>";
logOnInfo.ConnectionInfo.Password = "<password>";
logOnInfo.TableName = "Student";
CrystalReportViewer1.ReportSource = Server.MapPath(".") +
"\\StudentContactRoster.rpt";
CrystalReportViewer1.LogOnInfo.Add(logOnInfo);
I run it and get a logon error. I've checked everything, the server name,
database name, user ID, password, tablename, etc., and they all check out. I
use much the same parameters in the data adapters I use elsewhere in the
application, and they work.
I tried a different solution, suggested by a post-er on this newsgroup, and
came up with this:
TableLogOnInfo li = null;
CrystalDecisions.CrystalReports.Engine.ReportDocument rp =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
rp.Load(Server.MapPath(".") + "\\StudentContactRoster.rpt");
for (int i = 0; i < rp.Database.Tables.Count; i++)
{
li = rp.Database.Tables.LogOnInfo;
TableLogOnInfo logOnInfo = new TableLogOnInfo();
li.ConnectionInfo.ServerName = "<server name>";
li.ConnectionInfo.DatabaseName = "<dbname>";
li.ConnectionInfo.UserID = "<user id>";
li.ConnectionInfo.Password = "<password>";
rp.Database.Tables.ApplyLogOnInfo(li);
}
StudentContactRosterReportViewer.ReportSource = rp;
I run this, using the same parameters as the first code block, and also get
a logon error. Anyone got some clues about what's going on here?
Thanks.
My original code looked like this:
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
logOnInfo.ConnectionInfo.ServerName = "<server name>";
logOnInfo.ConnectionInfo.DatabaseName = "<dbname>";
logOnInfo.ConnectionInfo.UserID = "<user id>";
logOnInfo.ConnectionInfo.Password = "<password>";
logOnInfo.TableName = "Student";
CrystalReportViewer1.ReportSource = Server.MapPath(".") +
"\\StudentContactRoster.rpt";
CrystalReportViewer1.LogOnInfo.Add(logOnInfo);
I run it and get a logon error. I've checked everything, the server name,
database name, user ID, password, tablename, etc., and they all check out. I
use much the same parameters in the data adapters I use elsewhere in the
application, and they work.
I tried a different solution, suggested by a post-er on this newsgroup, and
came up with this:
TableLogOnInfo li = null;
CrystalDecisions.CrystalReports.Engine.ReportDocument rp =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
rp.Load(Server.MapPath(".") + "\\StudentContactRoster.rpt");
for (int i = 0; i < rp.Database.Tables.Count; i++)
{
li = rp.Database.Tables.LogOnInfo;
TableLogOnInfo logOnInfo = new TableLogOnInfo();
li.ConnectionInfo.ServerName = "<server name>";
li.ConnectionInfo.DatabaseName = "<dbname>";
li.ConnectionInfo.UserID = "<user id>";
li.ConnectionInfo.Password = "<password>";
rp.Database.Tables.ApplyLogOnInfo(li);
}
StudentContactRosterReportViewer.ReportSource = rp;
I run this, using the same parameters as the first code block, and also get
a logon error. Anyone got some clues about what's going on here?
Thanks.