i dont know how to go about resolving this problem. such a toughy and my brains are almost dead!

Basically, if we add a "criteria" into a gridview, then we delete a row of critieria and add a new one, this is the exception I get:

Code:
Column 'ReportCriteriaId, ReportId' is constrained to be unique.  Value '4, 3' is already present.
the 4, 3 varies.

This is throwing up from the dataset tableadapter code that this person created in VS.NET

any ideas how to go about resolving this issue?

the code when removing the criteria is this (in the rowDeleting event of the gridview)

Code:
protected void gvReportSpec_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
{

   //some stuff here to get hold of the row to delete in the tableadapter/datatable
   oReportCriteriaRow.Delete();
   this.BindCriteria();

   if (this.gvReportSpec.Rows.Count > 0)
   {
      DropDownList ddList = this.gvReportSpec.FindControl("ControlName");
      if (ddList != null)
      {
         ddList.Items.Clear();
      }
   }

}

basically when deleting, it will find the row to delete in the tableset/datatable and do a "Delete" on it. Then it will find the next row in the gridview and remove the items in the drop down list.

But then when we add a crieteria, (another row) it will throw the exception as above. The code for adding a criteria:

Code:
this.CurrentReportSet.ReportCriteria.AddReportCriteriaRow("", CurrentReportSet.ReportCriteriaType.FindByReportCriteriaTypeId(ReportCriteriaId_IsNotNull), ")", "AND", "ColumnFieldName", "TableName", CurrentReport, CurrentReportSet.ReportCriteria.Rows.Count + 1);

no idea if this helps but I'm still learning my way through the code given!

any help is appreciated on how to overcome this contraints problem when removing a row of data from the gridview and adding a new one