vs 水晶报表每次都要验证数据库
我已经在代码中写入
TableLogOnInfo logOnInfo = new TableLogOnInfo();
foreach (CrystalDecisions.CrystalReports.Engine.Table tb in rpt.Database.Tables)
{
logOnInfo = tb.LogOnInfo;
logOnInfo.ConnectionInfo.ServerName = "servername";
logOnInfo.ConnectionInfo.DatabaseName = "databasename";
logOnInfo.ConnectionInfo.UserID = "sa";
logOnInfo.ConnectionInfo.Password = "sa";
tb.ApplyLogOnInfo(logOnInfo);
}
也设置了 首次刷新时验证 的勾去掉 还是不行
------解决方案--------------------
把代码写到Page_Load中,如果是VS2008则写到Page_Init中
具体参考
http://topic.csdn.net/u/20090626/17/8090bf70-bed9-41ac-9e09-c0a6a7ab4cb8.html
------解决方案--------------------我的不需要 代码是
前
<div>
<br />
<CR:CrystalReportViewer ID="ProfessRpt" runat="server" AutoDataBind="true" />
<CR:CrystalReportSource ID="ProfessRptSource" runat="server">
</CR:CrystalReportSource>
</div>
----------------------------------------cs
protected void Page_Load(object sender, EventArgs e)
{
ProfessRptSource.ReportDocument.Load(Server.MapPath("HicCount.rpt"));
ProfessRptSource.DataBind();
ProfessRptSource.ReportDocument.SetDatabaseLogon("sa","cancer");
ProfessRpt.ReportSource = ProfessRptSource;
ProfessRpt.DataBind();
}
------解决方案--------------------汗,楼主好像把pull和push搞混了,两者混用了