Hi
I have two tables in my database. PRODUCT and PRODUCT_GROUP. PRODUCT has a foreign key to PRODUCT_GROUP. I generated a typed dataset using VS.net and added a relationship between the two tables. When I call my get WebMethod for the PRODUCT table I get the System.Data.Con straintExceptio n exception. The get WebMethod for PRODUCT_GROUP works fine. When I remove the relationship the get WebMethod for PRODUCT works fine too. Both tables only have one row of data in them and the database is already enforcing the relationship. Also if I delete my one row of info in PRODUCT, the webservice works fine. What am I doing wrong. Please help
Here is the .xsd
<?xml version="1.0" standalone="yes " ?><xs:schema id="ProductTest DataSet" targetNamespace ="http://www.tempuri.org/ProductTestData Set.xsd
xmlns:mstns="ht tp://www.tempuri.org/ProductTestData Set.xsd" xmlns="http://www.tempuri.org/ProductTestData Set.xsd
xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata
attributeFormDe fault="qualifie d" elementFormDefa ult="qualified" ><xs:element name="ProductTe stDataSet" msdata:IsDataSe t="true"><xs:co mplexType><xs:c hoice maxOccurs="unbo unded"><xs:elem ent name="PRODUCT_G ROUP"><xs:compl exType><xs:sequ ence><xs:elemen t name="ID" msdata:ReadOnly ="true" msdata:AutoIncr ement="true" type="xs:int" /><xs:element name="NAME" type="xs:string " minOccurs="0" /></xs:sequence></xs:complexType> </xs:element><xs: element name="PRODUCT"> <xs:complexType ><xs:sequence>< xs:element name="ID" msdata:ReadOnly ="true" msdata:AutoIncr ement="true" type="xs:int" /><xs:element name="NAME" type="xs:string " minOccurs="0" /><xs:element name="PRODUCT_G ROUP_ID" type="xs:int" minOccurs="0" /></xs:sequence></xs:complexType> </xs:element></xs:choice></xs:complexType> <xs:unique name="Constrain t1" msdata:PrimaryK ey="true"><xs:s elector xpath=".//mstns:PRODUCT_G ROUP" /><xs:field xpath="mstns:ID " /></xs:unique><xs:u nique name="ProductSe lectCommand_Con straint1" msdata:Constrai ntName="Constra int1" msdata:PrimaryK ey="true"><xs:s elector xpath=".//mstns:PRODUCT" /><xs:field xpath="mstns:ID " /></xs:unique><xs:k eyref name="PRODUCT_G ROUPPRODUCT" refer="mstns:Co nstraint1" msdata:AcceptRe jectRule="None
msdata:DeleteRu le="None" msdata:UpdateRu le="None"><xs:s elector xpath=".//mstns:PRODUCT" /><xs:field xpath="mstns:PR ODUCT_GROUP_ID" /></xs:keyref></xs:element></xs:schema
Thanks
Nim
ps. Here is the full error
System.Data.Con straintExceptio n: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints
at System.Data.Dat aSet.FailedEnab leConstraints(
at System.Data.Dat aSet.EnableCons traints(
at System.Data.Dat aSet.set_Enforc eConstraints(Bo olean value
at System.Data.Dat aTable.EndLoadD ata(
at System.Data.Com mon.DbDataAdapt er.FillFromRead er(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterCo lumn, Object parentChapterVa lue
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le dataTable, IDataReader dataReader
at System.Data.Com mon.DbDataAdapt er.FillFromComm and(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le dataTable, IDbCommand command, CommandBehavior behavior
at System.Data.Com mon.DbDataAdapt er.Fill(DataTab le dataTable
at SimpleTestingPr oduct.Service1. getProduct() in c:\inetpub\wwwr oot\simpletesti ngproduct\servi ce1.asmx.cs:lin e 25 0 3417 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Seibold |
last post by:
Hello NG,
sorry for pasting that much code but I just can't figure out how get the
<key><keyref> to work in XML Schema. I am using XMLSpy 4.3 for editing my
XML. I want to represent a recursive 1:n relationship between a database
table AdminUnit (i.e., States consist of Counties).
|
by: Json |
last post by:
Ok, brand new to SQLXML 3.0 and its various issues. Heres what I'm
trying to do:
1. I am trying to load xml data into an empty SQL table from my .NET
console application.
2. This isn't a huge amount of data so I'm not interested in
BulkXMLLoad (or whatever its called).
3. I have the xml and xml schema ready to go, with (I hope) the proper
sql annotations.
|
by: JSheble |
last post by:
I have a dynamically created dataset, created thusly:
DataTable dtTime = new DataTable("times");
DataColumn dtColumns = new DataColumn;
dtColumns = new DataColumn("id", System.Type.GetType("System.String"));
dtColumns.AutoIncrement = true;
dtColumns.AutoIncrementSeed = 1;
dtColumns = new DataColumn("date",
System.Type.GetType("System.String"));
dtColumns = new DataColumn("proj",
|
by: LunchBox |
last post by:
I'm getting null values in a DataSet which is pulling its data from a web
service. The nulls are creating 'System.Data.ConstraintException' in the
fields that do not allow columns. I've tried finding the reason for the
nulls, but I'm out of time. I need to erase the rows with nulls from the
dataset. Here is what I have so far, and although it throws an Invalid
Operation exception, it does delete the row with the null. But obviously...
|
by: Kiran |
last post by:
Hi,
I am using typed dataset for Employees Table and found a problem, can anyone tell me what's wrong
Case 1:
Employees Table:
ID: int,Not Null,Idendity, Primary col
Name:varchar(20),Not Null
Type: Varchar(5), Null(Allowed)
| |
by: Optimus |
last post by:
Hi everyone,
I currently develop an application in vs.net 2005 with vb.net.
I was trying to use typed dataset and I've got in trouble for
converting untyped dataset
into Typed DataSet. I don't know why I cannot perform this casting
operation properly.
First off, I've got my Typed DataSet named "AuthInfo" declared and I
then created an instance of that class. What I'd like to do next is to
perform querying through the method...
|
by: Mike |
last post by:
Hi,
I'm delevloping a webservice that returns typed datasets with visual
studio 2005. The problem is, that the typed data set in the client app
is not the same as in the webservice. If I change the property
'NullValue' of the row to (empty) the dataset on the client does still
throw an exception. I added a column to see if the project updates the
reference.cs - and it does!
This is the generated code from the original dataset:
|
by: Peter Bradley |
last post by:
Hi all,
This post is sort of tangentially related to my earlier posts on
configuration files for DLLs.
Does anyone know how to create typed DataSets using VS2005's new DataSet
designer, but with the ability to configure the connection string via a
config file? The designer seems to hard-code the connection string into the
dataset itself, which just can't be right.
|
by: =?Utf-8?B?TWF4R3J1dmVu?= |
last post by:
I have a DLL that implements the Business and Data Layers for a number of
different websites. That DLL uses a Strongly Typed DataSet to interface to
the Data Source which is SQL Server.
There is a connection string in the DLL that is causes me grief. It points
at a particular instance of database. I hae to recompile the DLL for each
WebSite.
How can I re-use that DLL on different websites and have it point to
different instances of...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |