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.Conne ctionInfo.Serve rName = "<server name>";
logOnInfo.Conne ctionInfo.Datab aseName = "<dbname>";
logOnInfo.Conne ctionInfo.UserI D = "<user id>";
logOnInfo.Conne ctionInfo.Passw ord = "<password> ";
logOnInfo.Table Name = "Student";
CrystalReportVi ewer1.ReportSou rce = Server.MapPath( ".") +
"\\StudentConta ctRoster.rpt";
CrystalReportVi ewer1.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;
CrystalDecision s.CrystalReport s.Engine.Report Document rp =
new CrystalDecision s.CrystalReport s.Engine.Report Document();
rp.Load(Server. MapPath(".") + "\\StudentConta ctRoster.rpt");
for (int i = 0; i < rp.Database.Tab les.Count; i++)
{
li = rp.Database.Tab les[i].LogOnInfo;
TableLogOnInfo logOnInfo = new TableLogOnInfo( );
li.ConnectionIn fo.ServerName = "<server name>";
li.ConnectionIn fo.DatabaseName = "<dbname>";
li.ConnectionIn fo.UserID = "<user id>";
li.ConnectionIn fo.Password = "<password> ";
rp.Database.Tab les[i].ApplyLogOnInfo (li);
}
StudentContactR osterReportView er.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.