none
ASP.net Datasets RRS feed

  • Question

  • I've created a dataset in visual web dev, this is built from a SQL server express database with Stored Procedures for all the queries.

     

    I've added a table adapter which returns all 4 fields from the table.

    I added another query to that table adapter which returns only 2 of the 4.

     

    When i bind a gridview to the method of my BLL (below) which returns the second query I get the error.

     

    Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

    It appears to me that this is because it's not returning all 4 of the fields, but I have no non-null or foreign key constraints, and the record is unique with the unique id being returned.

     

    My code is:

     

    Code Snippet

    <System.ComponentModel.DataObjectMethodAttribute(ComponentModel.DataObjectMethodType.Select, True)> _

    Public Function getQuestion(ByVal question_id As Integer) As questions.View_QuestionDataTable

    Return Adapter.GetPartQuestion(question_id)

    End Function

     

     

     

    Can I not return a different schema from the same tableAdapter?

     

    Any suggestions welcome, Thanks.

    Thursday, August 16, 2007 3:28 PM