Showing posts with label shown. Show all posts
Showing posts with label shown. Show all posts

Wednesday, March 28, 2012

Report Parameter Errors

Hello.

I've been trying to figure this out for a day now and am getting frustrated. (ARGH!) As shown below, I have 4 parameters in my sproc. The @.Action is being set as "getAll", the @.FormID is coming from a textbox control, and the other 2 should allow nulls (this is in Local mode in a Web Form). I keep getting the error message below.

I do have these params defined in my .rdlc, then I'm setting the param values in my form's code-behind.

What am I doing wrong?


CREATE PROCEDURE dbo.spFormResults
(
@.Action VarChar( 20 ),
@.ResultID INT = NULL,

@.FormID int = NULL,

@.Data text = NULL
)
AS

.....


string strAction = "getAll";

ReportParameter actionParam = new ReportParameter("Action", strAction, false);

ReportParameter resultIDParam = new ReportParameter("ResultID", "0", false);

ReportParameter formIDParam = new ReportParameter("FormID", txtFormID.Text, false);

ReportParameter dataParam = new ReportParameter("Data", string.Empty, false);

this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { actionParam, resultIDParam,

formIDParam, dataParam });

this.ReportViewer1.LocalReport.Refresh();


An error has occurred during report processing.

  • Exception has been thrown by the target of an invocation.
  • Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    To me it seems you are looking in the wrong place for the error. It looks like the sort of error message that actually comes from the database, not RS. You need to check whether some of the columns you are searching on are set to NOT NULL in the schema.

    HTH,

    sluggy

    |||

    Yes, I thought that might be the case, too, but when I looked at it in the debugger, none of the parameters had values in them -- even though I was setting them in my code. So I'm still thinking the values of the params aren't being set somehow.

  • Tuesday, February 21, 2012

    Report Header

    Hi,
    I need to create a report header that will only be shown on the first page. And I want to use the built in header system that is included with report. I can't create a custom header on the body part because I am using multiple columns for report rendering. Currently the header system either displays the header on all pages or it shows in all pages except the first or last page. Any help is greatly appreciated. Thanks.
    Try setting the hidden property to true if page number > 1.|||

    Hi,

    You can hide the components of the page header by writting visibility condition on the pagenumber.

    But that will create the issue of extra space on the top of the page, work around for this is to use TABLE HEADER and set repeatoneachpage property as false.

    Hope this helps.

    Priyank.

    |||Thank you Priyank for the response. I did use Table Header as you suggested. And it did solve the issue I was having.
    And thank you also LG1815 for your response.