本文介绍了您要求的报告需要更多信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 如何在不提供此消息和登录提示的情况下使报告正常工作? in在sample.aspx中写入代码: < CR:CrystalReportViewer ID = CrystalReportViewer1 runat = server AutoDataBind = true / > 在sample.aspx.cs中,信息objInformation; ConnectionInfo connectionInfo = new ConnectionInfo(); 受保护 void Page_Load(对象发​​件人,EventArgs e) { 尝试 { SetDBLogonForReport(connectionInfo ); objInformation = new 信息(); DataSet ds = new DataSet(); ds = objInformation.GetAllInformation(); ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath( 〜/ Reports / CrystalReport.rpt) ); rpt.SetDataSource(ds); CrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); } catch (例外情况) { } } private void SetDBLogonForReport(ConnectionInfo connectionInfo) { TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo; foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos) { tableLogOnInfo。 ConnectionInfo = connectionInfo; connectionInfo.DatabaseName = DatabaseName; connectionInfo.UserID = UserID; connectionInfo.Password = 密码; } } 但是我再次使报告正常工作而不提供此消息和登录提示? 它不允许我为DB名称输入任何内容。我正在使用VS 2010专业版的水晶报表,后端DB是本地机器上的Sql server。 IIS 5.2也在同一台机器上(XP教授)。 我使用的控件是CrystalReportsPartsViewer。请帮助解决问题,Visual Studio 2010的新功能。解决方案 看起来您设置了登录参数但尚未应用它。 CrystalReportViewer1.SetDatabaseLogon( myUsername, myPassword); 我遇到了同样的问题,但我找到了一个简单的解决方案。你只需要用数据表替换数据集,它就可以正常工作.. how do i get the report to work correctly without giving this message and login prompt?in have write code in sample.aspx :<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />In sample.aspx.cs, Information objInformation;ConnectionInfo connectionInfo = new ConnectionInfo();protected void Page_Load(object sender, EventArgs e){ try { SetDBLogonForReport(connectionInfo); objInformation = new Information(); DataSet ds = new DataSet(); ds = objInformation.GetAllInformation(); ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath("~/Reports/CrystalReport.rpt")); rpt.SetDataSource(ds); CrystalReportViewer1.ReportSource = rpt; CrystalReportViewer1.DataBind(); } catch(Exception ex) { }}private void SetDBLogonForReport(ConnectionInfo connectionInfo){ TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo; foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos) { tableLogOnInfo.ConnectionInfo = connectionInfo; connectionInfo.DatabaseName = "DatabaseName "; connectionInfo.UserID = "UserID "; connectionInfo.Password = "Password "; }}but again i get the report to work correctly without giving this message and login prompt?It will not allow me to enter anything for DB name. I am using crystal reports for VS 2010 professional, backend DB is Sql server which is on local machine. IIS 5.2 is also on same machine (XP prof).The control that I am using is CrystalReportsPartsViewer. Please help with issue, new with Visual Studio 2010. 解决方案 Looks like you set the logon parameters but have not applied it.CrystalReportViewer1.SetDatabaseLogon("myUsername", "myPassword");I have the same problem but I find a simple solution to it. you just need to replace dataset with the data table and it will work fine.. 这篇关于您要求的报告需要更多信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-11 00:42