Showing posts with label valid. Show all posts
Showing posts with label valid. Show all posts

Monday, March 26, 2012

ReportViewer :: Failed to enable constraints. But my statement is valid!

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.

Why do I keep getting this error, even when not using any data on the report. When I run the query in SQL server I get a resultset. However when I try to render the report I get this error.

Thanks!

I'm not using Report Services for the data I use in my reports, but when I get this error in my Report Viewer controls it's because VS carried over the primary keys from source views when I created my SQL Server table adapters.

To remedy this, I open the dataset file I'm using in my VS project and find the table adapter I'm using as my data source for the problematic report. If there are keys next to any columns (thereby marking them as primary keys in the table adapter), I right click one of the columns and select "Delete Key". I make sure all the keys are removed and then save the file and try the report again. This has fixed it every time (and every time this happened, the error never showed when I previewed the data in VS or in SQL Server itself - only when I tried to render the report from my site. Quite maddening.).

Hope this works for you, too . . .

|||

What a man!!! Worked a treat. Thanks

M

ReportViewer - Operation is not valid due to the current state of the object

Hi,
I'm getting an InvalidOperationException, message ("Operation is not
valid due to the current state of the object") when setting the
ServerReport.ReportServerUrl (or ServerReport.ReportPath) property of
the VS2005 ReportViewer control after performing a drilldown.
I've reproduced this error in the following scenario:
1) Clean Windows 2003 server with SP1 and latest hot fixes (installed
to defaults except UK English).
2) Clean SQL Server 2005 (RTM) install with SQL Server and Reporting
Services component (all installed to defaults).
3) Clean VS2005 (RTM) web app (default.aspx and default.aspx.cs, see
below) (running on a Windows XP Pro workstation under VS2005
Development Server but same thing on W2003 Web Server).
4) Clean reports (RSTest.rdl and RSTest2.rdl, see below).
The error can be reproduced as follows:
1) Click Button1 (standard asp:button). This sets
ReportViewer1.ServerReport.ReportPath and
ReportViewer1.ServerReport.ReportUrl to RSTest.rdl and correctly
displays the report.
2) Click the drilldown link in the report. This correctly displays
RSTest2.rdl.
3) Repeat step1. This causes the error.
Relevant code snippets are:
default.aspx:
<rsweb:ReportViewer ID="ReportViewer1" runat="server"
ProcessingMode="Remote">
</rsweb:ReportViewer>
<asp:Button ID="Button1" runat="server" Text="Button"
OnClick="Button1_Click" />
default.aspx.cs:
protected void Button1_Click(object sender, EventArgs e)
{
ReportViewer1.ServerReport.ReportServerUrl = new
Uri("http://dstst1/ReportServer");
ReportViewer1.ServerReport.ReportPath = "/RS Test
Project/RSTest";
}
RSTest.rdl:
<Textbox Name="textbox1">
...snip...
<Action>
<Drillthrough>
<ReportName>RSTest2</ReportName>
</Drillthrough>
</Action>
...snip...
</Textbox>
Has anyone got any ideas or is this a bug as I suspect?
Regards,
Ian Addis
Dorset Software Services Limited
Poole, Dorset, ENGLAND
Keywords: SQL Server 2005 Reporting Services ReportViewer drilldown
InvalidOperationException "Operation is not valid due to the current
state of the object" ServerReport.ReportServerUrl
ServerReport.ReportPathI have this exact same problem but have not found an answer. Did you
figure out the problem and if not how did you work around it? I am
using a nearly identical software configuration.
Scott Wylie
i.p.addis@.dunelm.org.uk wrote:
> Hi,
> I'm getting an InvalidOperationException, message ("Operation is not
> valid due to the current state of the object") when setting the
> ServerReport.ReportServerUrl (or ServerReport.ReportPath) property of
> the VS2005 ReportViewer control after performing a drilldown.
> I've reproduced this error in the following scenario:
> 1) Clean Windows 2003 server with SP1 and latest hot fixes (installed
> to defaults except UK English).
> 2) Clean SQL Server 2005 (RTM) install with SQL Server and Reporting
> Services component (all installed to defaults).
> 3) Clean VS2005 (RTM) web app (default.aspx and default.aspx.cs, see
> below) (running on a Windows XP Pro workstation under VS2005
> Development Server but same thing on W2003 Web Server).
> 4) Clean reports (RSTest.rdl and RSTest2.rdl, see below).
>
> The error can be reproduced as follows:
> 1) Click Button1 (standard asp:button). This sets
> ReportViewer1.ServerReport.ReportPath and
> ReportViewer1.ServerReport.ReportUrl to RSTest.rdl and correctly
> displays the report.
> 2) Click the drilldown link in the report. This correctly displays
> RSTest2.rdl.
> 3) Repeat step1. This causes the error.
> Relevant code snippets are:
> default.aspx:
> <rsweb:ReportViewer ID="ReportViewer1" runat="server"
> ProcessingMode="Remote">
> </rsweb:ReportViewer>
> <asp:Button ID="Button1" runat="server" Text="Button"
> OnClick="Button1_Click" />
>
> default.aspx.cs:
> protected void Button1_Click(object sender, EventArgs e)
> {
> ReportViewer1.ServerReport.ReportServerUrl = new
> Uri("http://dstst1/ReportServer");
> ReportViewer1.ServerReport.ReportPath = "/RS Test
> Project/RSTest";
> }
>
> RSTest.rdl:
> <Textbox Name="textbox1">
> ...snip...
> <Action>
> <Drillthrough>
> <ReportName>RSTest2</ReportName>
> </Drillthrough>
> </Action>
> ...snip...
> </Textbox>
> Has anyone got any ideas or is this a bug as I suspect?
> Regards,
> Ian Addis
> Dorset Software Services Limited
> Poole, Dorset, ENGLAND
> Keywords: SQL Server 2005 Reporting Services ReportViewer drilldown
> InvalidOperationException "Operation is not valid due to the current
> state of the object" ServerReport.ReportServerUrl
> ServerReport.ReportPath|||strw2001@.gmail.com wrote:
> I have this exact same problem but have not found an answer. Did you
> figure out the problem and if not how did you work around it? I am
> using a nearly identical software configuration.
> Scott Wylie
Nope, no solution as unfortunately the company I'm working with is
currently re-negotiating their support agreement with Microsoft. I'm
fairly sure it's a bug though, I was hoping someone from MS would be on
here to comment considering it's easily reproducible.
Ian A.

ReportServerUrl element is not a valid configuration file element

Hi,

I get the error specified in the subject

"ReportServerUrl element is not a valid configuration file element"

ini the report manager if I replace

<ReportServerUrl></ReportServerUrl>

tags in RSWebApplication.cofig file with

<ReportServerUrl>http://<computername>/ReportServer</ReportServerUrl>

Any ideas why I should get that?. If the element was not valid, it should not have worked even earlier?

Thanks.

Have you also set ReportServerVirtualDirectory ?
Take a look at: http://msdn2.microsoft.com/en-us/library/ms155878.aspx

ReportServerURL and ReportServerVirtualDirectory are mutually exclusive. If you specify ReportServerURL, you must delete the entry for ReportServerVirtualDirectory