.net – ‘The report you requested requires further information’ error using SqlDataSource with Crystal Reports

crystal-reportsnetvisual studiowebforms

I have followed the Microsoft tutorial here to create a Crystal Report (with v12.0) within Visual Studio and attach it to a web form using a CrystalReportViewer, CrystalReportSource and SqlDataSource as I wish it to read data from my SQL Server instance. The report will load fine once (this appears to be snapshot data though saved embedded within the .rpt file) with this web form markup:

<CR:CrystalReportViewer ID="crystalReportViewer" runat="server" 
            AutoDataBind="true" 
            GroupTreeImagesFolderUrl="" HasRefreshButton="True" Height="895px" 
            ReportSourceID="crystalReportSource" ToolbarImagesFolderUrl="" 
            ToolPanelWidth="200px" Width="1365px" />
        <CR:CrystalReportSource ID="crystalReportSource" runat="server" 
            EnableCaching="False">
            <Report FileName="ClientLoginHistory.rpt">
                <DataSources>
                    <CR:DataSourceRef DataSourceID="sqlDataSource" />
                </DataSources>
            </Report>
        </CR:CrystalReportSource>
        <asp:SqlDataSource ID="sqlDataSource" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbReportsConnectionString %>" 
            SelectCommand="{{ select query is here }}">
        </asp:SqlDataSource>

(please tell me if you can see any configuration errors)

But as soon as I press "Refresh" on the Crystal Reports Viewer toolbar I receive the following error:

"The report you requested requires further information."

with fields to enter DB login information…

The reason I say 'error', is because I purposely followed the tutorial attaching a Crystal Report to a SQL Data Source as so I could specify an existing Connection String from my Web.config, which has the username and password pre-set.

It actually appears it isn't even USING the connection string from Web.config as if I remove reference to the SqlDataSource (see below code snippet) it still loads with snapshot data, then a 'refresh' prompts for the user/pass and once entered the report loads fine:

<CR:CrystalReportViewer ID="crystalReportViewer" runat="server" 
            AutoDataBind="true" 
            GroupTreeImagesFolderUrl="" HasRefreshButton="True" Height="895px" 
            ReportSourceID="crystalReportSource" ToolbarImagesFolderUrl="" 
            ToolPanelWidth="200px" Width="1365px" />
        <CR:CrystalReportSource ID="crystalReportSource" runat="server" 
            EnableCaching="False">
            </Report>
        </CR:CrystalReportSource>

I imagine this must be linked to an internal db connection embedded in the report instead of the sqlDataSource?? This would be quite probable because when you create the report, you select your database tables and fields over an ODBC link and it saves the connection information into the report I think :S

So, after much scouring on the net, I found a way to avoid this error, but again, I do not believe it's reading the Web.config connectionString but rather the embedded connection in the .rpt file.

protected void Page_Load(object sender, EventArgs e)
        {
            crystalReportSource.ReportDocument.SetDatabaseLogon("user", "real_pass");
        }

This works to circumvent the continuous prompt. But is super nasty and I do not want to use it.

Help!

Best Answer

I was having similar issues after following your code above and the tutorial you mention. I found that specifying the TableName property allowed my report to run as expected without having to set any logon parameters at all.

<CR:DataSourceRef DataSourceID="sqlDataSource" TableName="Chips" />
Related Topic