We are designing an report which uses storeprocedure to fetch data from database,We created one dataset which get correctly filled
with data (we confirm It by using viewdata tool),however during rendering it gives following error,
An error has occured while processing Report '':
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. |
Same storeprocedure we are using with RDLC report which is working fine.
Please suggest,
Thanks,
Tejas.
7 Answers, 1 is accepted
Unfortunately we would need more information (how and where do you bind your report) or best a sample project that shows the problem at hand. In case you have not reviewed this KB article, please check it out.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Hi Here is the code where I bind datasource to the report.I have already developed some reports with same steps are working fine.
namespace
ReportClassLibrary
{
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Telerik.Reporting;
using Telerik.Reporting.Drawing;
/// <summary>
/// Summary description for ReportABCD.
/// </summary>
public partial class ReportABCD : Telerik.Reporting.Report
{
public ReportABCD()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
this.DataSource = null;
//
// TODO: Add any constructor code after InitializeComponent call
//
}
private void ReportABCD_NeedDataSource(object sender, EventArgs e)
{
DataSetABCDTableAdapters.
MTS_spForPhone_HeadCountTableAdapter tbAdapter =
new ReportClassLibrary.DataSetABCDTableAdapters.MTS_spForPhone_HeadCountTableAdapter();
Telerik.Reporting.Processing.
Report report = (Telerik.Reporting.Processing.Report)sender;
report.DataSource = tbAdapter.GetData(2006, 2008);
}
}
}
Your code is correct and the fact that it works fine on other reports only confirms this. We're afraid that unless you provide us with a working report that exhibits the error you've encountered, we would not be of much help. You can do this by providing us with a link to a sample project here or open a support ticket and attach it to it.
Kind regards,
Steve
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Every time I run across this error, it is because there is something wrong with a Table Adapter.
I populate my report using an objectdatasource that has its DataSource equal to a WCF service call that returns a data table. For the service calls that resulted in this error, I debugged and noticed the call would fail to return from the service - I could hit the service call line, but debugging would break and never hit the next line and the report viewer would show the violating error.
Researching led me to the table adapter (on the WCF service side) I was filling during the service call. There was always something set wrong for a column's properties in the table adapter.
If you come across this problem, I recommend checking the NullValue and the MaxLength Properties for each column and validating the returned data does not violate their values.
For example:
If a field will sometimes return nothing then the NullValue property must be set to either Empty or Nothing instead of Throw Exception.
If you have MaxLength set at 2 and there is a row with a value great than 2 digits long, you will get this error - because the length of the new row exceeds the MaxLength property. Change the MaxLength to fit the largest number (or default to -1).
Hope this helps someone.