Hi all, Good day to every one! This is my first post here!
So, I have this crystal report (CR version 9) and I want to change its database location programmatically. I am doing something right now, but there is a problem. Perhaps my code would explain better.
private void MainReport_Load(object sender, EventArgs e)
{
var constr = string.Empty;
constr = Application.StartupPath;
if (Generate.bForProjects)
constr = Path.Combine(constr, @"Reports\Projects.rpt");
else
constr = Path.Combine(constr, @"Reports\Other.rpt");
var myConInfo = new CrystalDecisions.Shared.TableLogOnInfo();
reportDocument1.Load(constr);
myConInfo.ConnectionInfo.DatabaseName = "ProjectData.mdb";
myConInfo.ConnectionInfo.ServerName = Application.StartupPath + @"\Data\ProjectData.mdb";
myConInfo.ConnectionInfo.Password = "";
myConInfo.ConnectionInfo.UserID = "";
reportDocument1.Database.Tables[0].ApplyLogOnInfo(myConInfo);
reportDocument1.Refresh();
crystalReportViewer1.ReportSource = reportDocument1;
crystalReportViewer1.Width = this.Width - 50;
crystalReportViewer1.Height = this.Height - 100;
}
Now, the problem is, when the form loads this screen pops up
http://i.stack.imgur.com/FouXC.png
So, my question is
Why the hel* is it coming up? And, when this comes up, I don't enter anything! That's right! I
just click finish and it loads the report perfectly! So, if it doesn't
needs anything, why the hel* is it asking me for a login?
Also, is this a wrong way to do it, is that's why this window comes up? Is there another way? Anyways, the most important question is how can I get rid of that login window? Its of no use because I don't enter anything? So how?