Crystal Reports - “The report you requested requires further information”

前端 未结 9 1449
梦如初夏
梦如初夏 2021-01-07 08:34

I have some Crystal Reports that were created using Crystal (external to Visual Studio) and are now loaded in the VS project. Before the report is previewed I set up the rep

相关标签:
9条回答
  • 2021-01-07 08:37

    put your coding to load event while bind report don't put ispostback=false condition

    example

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim dt As New dsPrintRevisionStatus
        Try
            lblHeader.Text = Request.QueryString("name")
            If lblHeader.Text = "Report- Print Revision Status" Then
                Dim rpt As New rpt_PrintRevisionStatus
                rpt.SetDataSource(sqlHandler.ExecuteDataTable("SELECT * FROM [Print Revision Status]"))
                crtViewer.ReportSource = rpt
                crtViewer.DataBind()
    
            End If
        Catch ex As Exception
            lblError.Text = ex.Message
        End Try
    End Sub
    
    0 讨论(0)
  • 2021-01-07 08:38

    Use EnableDatabaseLogonPrompt to see the actual error

    0 讨论(0)
  • 2021-01-07 08:39

    Use Data Table instead of Data Set .. It works..

    0 讨论(0)
  • 2021-01-07 08:41

    If you have added the logon info as follows,

            LogInfo.ConnectionInfo.ServerName = "mcqueen";
            LogInfo.ConnectionInfo.Password = "abc123";
            LogInfo.ConnectionInfo.UserID = "sa";
            LogInfo.ConnectionInfo.DatabaseName = "tbboss";
    
            crysViewer.LogOnInfo.Add(LogInfo);
    

    simply put the crysViewer.LogOnInfo.Add(LogInfo); at the end of crystal Viewer parameter settings. Like follows.

        LogInfo.ConnectionInfo.ServerName = "mcqueen";
        LogInfo.ConnectionInfo.Password = "abc123";
        LogInfo.ConnectionInfo.UserID = "sa";
        LogInfo.ConnectionInfo.DatabaseName = "tbboss";
    
    
        int exportFormatFlags =(int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
        crysViewer.AllowedExportFormats = exportFormatFlags;
        crysViewer.ReportSource = Server.MapPath("Reports/Report1.rpt");
        crysViewer.ParameterFieldInfo = paramFields;
    
        crysViewer.LogOnInfo.Add(LogInfo);
    
    0 讨论(0)
  • 2021-01-07 08:45

    I had same problem but I found a simple solution. i.e. just replace dataset with the data table and it will work fine.

    0 讨论(0)
  • 2021-01-07 08:46

    I have found the best way to fix a bug is to post the question to StackOverflow and 5 minutes later work it out yourself. Needless to say, I worked this out.

    As well as setting all the log on info in the report objects, I also have to do it in the Crystal Viewer component in ASP.NET. So I just write some code like this and it all works, no prompts.

    <CR:CrystalReportViewer Height="500px" ID="Viewer" runat="server" />
    
    var connectionInfo = new ConnectionInfo();
        connectionInfo.ServerName = "192.168.x.xxx";
        connectionInfo.DatabaseName = "xxxx";
        connectionInfo.Password = "xxxx";
        connectionInfo.UserID = "xxxx";
        connectionInfo.Type = ConnectionInfoType.SQL;
        connectionInfo.IntegratedSecurity = false;
    
    for (int i = 0; i < Viewer.LogOnInfo.Count; i++)
    {
        Viewer.LogOnInfo[i].ConnectionInfo = connectionInfo;
    }
    
    0 讨论(0)
提交回复
热议问题