1
votes

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 report database information like this in the report and all subreports.

        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;

        TableLogOnInfo logon = table.LogOnInfo;
        table.LogOnInfo.ConnectionInfo = connectionInfo;
        table.ApplyLogOnInfo(logon);

The report displays correctly when it is initially previewed but when I go to the next page in the report preview I get the message, "The report you requested requires further information" and are prompted for the database login information again. Once I have entered it here I am no longer prompted. It appears that the initial ConnectionInfo I set up is not sticking past the first page.

I am using Crystal XI and Visual Studio 2008.

9

9 Answers

6
votes

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;
}
4
votes

Try to set the EnableDatabaseLogonPrompt property in the crystal report viewer to false;

3
votes

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

1
votes

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
votes

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
votes

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
votes

Use EnableDatabaseLogonPrompt to see the actual error

0
votes

Solved!.. If it is written in "Not IsPostBack" condition please remove from it. I solved this issue asp below snapshot. enter image description here

Website link

0
votes

The future is nigh but Crystal Reports persists.

I was receiving this "error" from our crystal reports viewer. My problem was a dynamically generated query that was being created with consecutive ORs. The invalid SQL somehow elevated this "The report you requested requires further information" dialog box.

I fixed the query generation logic and do not see the dialog box anymore.