473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Exception Invalid 'Key' node inside constraint

Hi,
I'm using VS.net 2003 and C#.
I created (using buildin designer) a dataset with 2 tables.
TableOne has 2 fields: sName and sTable (both string) and a primary key
TestKey, set on sName.
TableData has 2 fields: sName and sData (both strings).
I have made a relation, based on sName, where TableOne is parent
element, and TableData is child. All other settings are default.

The designer generated the class and .xsd file.

In my code I have:

Dataset1 myTable = new Dataset1();
myTable.ReadXmlSchema(@"D:Dataset1.xsd");

and ReadXmlSchema throws an exception:

An unhandled exception of type 'System.Data.DataException' occurred in
system.data.dll

Additional information: Invalid 'Key' node inside constraint named:
TableOneTableData.

What I'm doing wrong?
I need the data set to store some user data and to save it to disk as
XML for future retrieval.

Thanks
Sunny

P.S. Here is the .xsd file (with line wraps):

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1"
targetNamespace="http://tempuri.org/Dataset1.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="http://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="TableOne">
<xs:complexType>
<xs:sequence>
<xs:element
name="sName" type="xs:string" minOccurs="0" />
<xs:element
name="sValue" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TableData">
<xs:complexType>
<xs:sequence>
<xs:element
name="sName" type="xs:string" minOccurs="0" />
<xs:element
name="sData" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="TestKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:TableOne" />
<xs:field xpath="mstns:sName" />
</xs:key>
<xs:keyref name="TableOneTableData" refer="TestKey">
<xs:selector xpath=".//mstns:TableData" />
<xs:field xpath="mstns:sName" />
</xs:keyref>
</xs:element>
</xs:schema>
Nov 11 '05 #1
3 6282
Hello Sunny,

Thanks for posting in the group.

I have replied this issue in vsnet.ide group. Please check it when you have
free time. I will follow up the issue there.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!From: Sunny <su******@icebergwireless.com>
!Subject: Exception Invalid 'Key' node inside constraint
!Date: Wed, 10 Sep 2003 16:31:23 -0500
!Message-ID: <MP************************@msnews.microsoft.com >
!Organization: Iceberg Wireless LLC
!MIME-Version: 1.0
!Content-Type: text/plain; charset="iso-8859-15"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: MicroPlanet Gravity v2.60
!Newsgroups:
microsoft.public.dotnet.languages.csharp,microsoft .public.dotnet.xml,microso
ft.public.vsnet.ide
!NNTP-Posting-Host: c-66-41-159-114.mn.client2.attbi.com 66.41.159.114
!Lines: 1
!Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.xml:15728
microsoft.public.vsnet.ide:8095
microsoft.public.dotnet.languages.csharp:183890
!X-Tomcat-NG: microsoft.public.dotnet.xml
!
!Hi,
!I'm using VS.net 2003 and C#.
!I created (using buildin designer) a dataset with 2 tables.
!TableOne has 2 fields: sName and sTable (both string) and a primary key
!TestKey, set on sName.
!TableData has 2 fields: sName and sData (both strings).
!I have made a relation, based on sName, where TableOne is parent
!element, and TableData is child. All other settings are default.
!
!The designer generated the class and .xsd file.
!
!In my code I have:
!
!Dataset1 myTable = new Dataset1();
!myTable.ReadXmlSchema(@"D:Dataset1.xsd");
!
!and ReadXmlSchema throws an exception:
!
!An unhandled exception of type 'System.Data.DataException' occurred in
!system.data.dll
!
!Additional information: Invalid 'Key' node inside constraint named:
!TableOneTableData.
!
!What I'm doing wrong?
!I need the data set to store some user data and to save it to disk as
!XML for future retrieval.
!
!Thanks
!Sunny
!
!P.S. Here is the .xsd file (with line wraps):
!
!<?xml version="1.0" encoding="utf-8" ?>
!<xs:schema id="Dataset1"
!targetNamespace="http://tempuri.org/Dataset1.xsd"
!elementFormDefault="qualified"
! attributeFormDefault="qualified"
!xmlns="http://tempuri.org/Dataset1.xsd"
!xmlns:mstns="http://tempuri.org/Dataset1.xsd"
! xmlns:xs="http://www.w3.org/2001/XMLSchema"
!xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
! <xs:element name="Dataset1" msdata:IsDataSet="true">
! <xs:complexType>
! <xs:choice maxOccurs="unbounded">
! <xs:element name="TableOne">
! <xs:complexType>
! <xs:sequence>
! <xs:element
!name="sName" type="xs:string" minOccurs="0" />
! <xs:element
!name="sValue" type="xs:string" minOccurs="0" />
! </xs:sequence>
! </xs:complexType>
! </xs:element>
! <xs:element name="TableData">
! <xs:complexType>
! <xs:sequence>
! <xs:element
!name="sName" type="xs:string" minOccurs="0" />
! <xs:element
!name="sData" type="xs:string" minOccurs="0" />
! </xs:sequence>
! </xs:complexType>
! </xs:element>
! </xs:choice>
! </xs:complexType>
! <xs:key name="TestKey" msdata:PrimaryKey="true">
! <xs:selector xpath=".//mstns:TableOne" />
! <xs:field xpath="mstns:sName" />
! </xs:key>
! <xs:keyref name="TableOneTableData" refer="TestKey">
! <xs:selector xpath=".//mstns:TableData" />
! <xs:field xpath="mstns:sName" />
! </xs:keyref>
! </xs:element>
!</xs:schema>
!

Nov 11 '05 #2
You don't need to read the schema if your using the dataset generated by the
MS tool.
It creates it all by itself, that's the main idea behind typed datasets.

Chris.

"Sunny" <su******@icebergwireless.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Hi,
I'm using VS.net 2003 and C#.
I created (using buildin designer) a dataset with 2 tables.
TableOne has 2 fields: sName and sTable (both string) and a primary key
TestKey, set on sName.
TableData has 2 fields: sName and sData (both strings).
I have made a relation, based on sName, where TableOne is parent
element, and TableData is child. All other settings are default.

The designer generated the class and .xsd file.

In my code I have:

Dataset1 myTable = new Dataset1();
myTable.ReadXmlSchema(@"D:Dataset1.xsd");

and ReadXmlSchema throws an exception:

An unhandled exception of type 'System.Data.DataException' occurred in
system.data.dll

Additional information: Invalid 'Key' node inside constraint named:
TableOneTableData.

What I'm doing wrong?
I need the data set to store some user data and to save it to disk as
XML for future retrieval.

Thanks
Sunny

P.S. Here is the .xsd file (with line wraps):

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="Dataset1"
targetNamespace="http://tempuri.org/Dataset1.xsd"
elementFormDefault="qualified"
attributeFormDefault="qualified"
xmlns="http://tempuri.org/Dataset1.xsd"
xmlns:mstns="http://tempuri.org/Dataset1.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Dataset1" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="TableOne">
<xs:complexType>
<xs:sequence>
<xs:element
name="sName" type="xs:string" minOccurs="0" />
<xs:element
name="sValue" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="TableData">
<xs:complexType>
<xs:sequence>
<xs:element
name="sName" type="xs:string" minOccurs="0" />
<xs:element
name="sData" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="TestKey" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:TableOne" />
<xs:field xpath="mstns:sName" />
</xs:key>
<xs:keyref name="TableOneTableData" refer="TestKey">
<xs:selector xpath=".//mstns:TableData" />
<xs:field xpath="mstns:sName" />
</xs:keyref>
</xs:element>
</xs:schema>

Nov 11 '05 #3
In article <#F**************@TK2MSFTNGP10.phx.gbl>, ch******@hotmail.com
says...
You don't need to read the schema if your using the dataset generated by the
MS tool.
It creates it all by itself, that's the main idea behind typed datasets.

Chris.

Thanks Cris and Yan-Hong

Sunny
Nov 11 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jeremiah Jacks | last post by:
I just upgraded to MySQL 4.0.14-standard for RedHat Linux and am using = the pre-compiled binaries. I have a database with INNODB tables. When I insert a row into one of the child tables, I get...
0
by: mpcohen | last post by:
I wrote a .net program to read from a database into a dataset and programatically created a foreign key reference. I then called writexmlschema to create an .xsd file. A program was run to...
4
by: maricel | last post by:
I have the following base table structure - DDL: CREATE TABLE "ADMINISTRATOR"."T1" ( "C1" INTEGER NOT NULL ) IN "TEST_TS" ; ALTER TABLE "ADMINISTRATOR"."T1" ADD PRIMARY KEY
4
by: Sunny | last post by:
Hi, I'm using VS.net 2003 and C#. I created (using buildin designer) a dataset with 2 tables. TableOne has 2 fields: sName and sTable (both string) and a primary key TestKey, set on sName....
0
by: Jonathan G. | last post by:
I'm writing my first windows service. I have a class called 'mainprocess' whose constructor is called by the service class. Within mainprocess, I declare an instance of another class I wrote,...
6
by: lgbjr | last post by:
Hi All, I've posted this question on the ComponentOne news group, but I thought it couldn't hurt to post it here as well, since, I’m assuming, some others out there are using the C1 controls for...
1
by: Mike Hunter | last post by:
(Please CC me on any replies as I'm not on the list) Hi, After a recent power failure, a program that uses a pgsql backend (netdisco) started to send me nastygrams. I tried the author's...
3
by: ferg | last post by:
I have a Customer table. The table has two different CHECK constraints. Then there is the Customer details dialog, which provides the user with an UI for changing users. I have some UPDATE sql,...
2
by: jarea | last post by:
I have read quite a bit about this error but I have yet to find the solution to my problem. I am trying to execute the following mysql statement: alter table line_items add...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.