Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem executing query against a view
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Problem executing query against a view
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01365414
Message ID:
01365414
Vues:
51
I have a form that allows the user to enter a variety of criteria for a query against a view that combines data from several different tables. I am using a SQL stored procedure to run the query. When I run the query from SQL, it runs correctly. When I run it from the test bench or my program, I get the following error:
System.Data.ConstraintException occurred
  Message="Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."
  Source="System.Data"
  StackTrace:
       at System.Data.DataSet.FailedEnableConstraints()
       at System.Data.DataSet.EnableConstraints()
       at System.Data.DataSet.set_EnforceConstraints(Boolean value)
       at System.Data.DataTable.EndLoadData()
       at System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)
       at System.Data.Common.DataAdapter.Fill(DataSet dataSet, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)
       at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
       at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
       at OakLeaf.MM.Main.Data.mmDataAccessSql.FillDataSet(DataSet ds, IDbDataAdapter dbAdapter, String tableName, Boolean clearOnFill)
I checked the business object and realized that it had set the primary key based on the table I had to select in order to build the object using the business layer generator. I regenerated everything to eliminate the rules object and removed any "required" flags for fields in the combined table. Then I manually commented out the primary key in the constructor of the business object. I continue to receive the same error, however. Any suggestions?
Linda Harmes
HiBit Technologies, Inc.
Répondre
Fil
Voir

Click here to load this message in the networking platform