且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

您要求的报告需要更多信息

更新时间:2023-02-07 17:16:36

看起来您设置了登录参数但尚未应用它。

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..