TypedDataset

J

J-T

I have a typed dataset as follows,which as you can see **Dose have a primary
key**.In the application when I try to use the Find mentod on it it says
that the table dosen't have the primary key,so I traced from the begining of
object creation and I noticed when I instanciate an object from my
typedataset (EntityReport m_EntityReport=new EntityReport();) ,there is not
primary key definded there!!!!
I used these two lines of code and the length of **test** is Zero!!! Why?
DataColumn[] test=m_EntityReport.Parameters.PrimaryKey;

Debug.WriteLine(test.Length.ToString());

Thanks a lot

*****************My Typed Dataset Schema***************

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="EntityReport"
targetNamespace="http://www.adventureworks.com/EntityReport.xsd"
elementFormDefault="qualified"
xmlns="http://www.adventureworks.com/EntityReport.xsd"
xmlns:mstns="http://tempuri.org/EntityReport.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:NS="http://www.adventureworks.com/EntityReport.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Description" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="Path" type="xs:string" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="CreatedDate" type="xs:date" />
<xs:element name="ExecutionTime" type="xs:dateTime" />
<xs:element name="CustomParams" type="xs:boolean" />
<xs:element name="SessionID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExecutionOption" type="xs:short" nillable="true" />
<xs:element name="HistoryID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExportFormat" type="xs:string" default="HTML4.0" />
<xs:element name="DeviceSettings" type="xs:string" nillable="true" />
<xs:element name="RemoteCall" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
<xs:key name="IDKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:ID" />
</xs:key>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
<xs:element name="ReportID" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="NameKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:Name" />
</xs:key>
<xs:keyref name="ReportsParameters" refer="IDKey">
<xs:selector xpath="." />
<xs:field xpath="NS:ReportID" />
</xs:keyref>
</xs:element>
</xs:schema>
 
M

Miha Markic [MVP C#]

Hi,

You have to check "Dataset primary key" check box when adding primary key.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

J-T said:
I have a typed dataset as follows,which as you can see **Dose have a
primary key**.In the application when I try to use the Find mentod on it it
says that the table dosen't have the primary key,so I traced from the
begining of object creation and I noticed when I instanciate an object from
my typedataset (EntityReport m_EntityReport=new EntityReport();) ,there is
not primary key definded there!!!!
I used these two lines of code and the length of **test** is Zero!!! Why?
DataColumn[] test=m_EntityReport.Parameters.PrimaryKey;

Debug.WriteLine(test.Length.ToString());

Thanks a lot

*****************My Typed Dataset Schema***************

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="EntityReport"
targetNamespace="http://www.adventureworks.com/EntityReport.xsd"
elementFormDefault="qualified"
xmlns="http://www.adventureworks.com/EntityReport.xsd"
xmlns:mstns="http://tempuri.org/EntityReport.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:NS="http://www.adventureworks.com/EntityReport.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Description" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="Path" type="xs:string" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="CreatedDate" type="xs:date" />
<xs:element name="ExecutionTime" type="xs:dateTime" />
<xs:element name="CustomParams" type="xs:boolean" />
<xs:element name="SessionID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExecutionOption" type="xs:short" nillable="true" />
<xs:element name="HistoryID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExportFormat" type="xs:string" default="HTML4.0" />
<xs:element name="DeviceSettings" type="xs:string" nillable="true" />
<xs:element name="RemoteCall" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
<xs:key name="IDKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:ID" />
</xs:key>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
<xs:element name="ReportID" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="NameKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:Name" />
</xs:key>
<xs:keyref name="ReportsParameters" refer="IDKey">
<xs:selector xpath="." />
<xs:field xpath="NS:ReportID" />
</xs:keyref>
</xs:element>
</xs:schema>
 
R

Ray5531

Where is that check box?

Thanks for your reply.

Miha Markic said:
Hi,

You have to check "Dataset primary key" check box when adding primary key.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

J-T said:
I have a typed dataset as follows,which as you can see **Dose have a
primary key**.In the application when I try to use the Find mentod on it
it says that the table dosen't have the primary key,so I traced from the
begining of object creation and I noticed when I instanciate an object
from my typedataset (EntityReport m_EntityReport=new EntityReport();)
,there is not primary key definded there!!!!
I used these two lines of code and the length of **test** is Zero!!! Why?
DataColumn[] test=m_EntityReport.Parameters.PrimaryKey;

Debug.WriteLine(test.Length.ToString());

Thanks a lot

*****************My Typed Dataset Schema***************

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="EntityReport"
targetNamespace="http://www.adventureworks.com/EntityReport.xsd"
elementFormDefault="qualified"
xmlns="http://www.adventureworks.com/EntityReport.xsd"
xmlns:mstns="http://tempuri.org/EntityReport.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:NS="http://www.adventureworks.com/EntityReport.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Description" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="Path" type="xs:string" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="CreatedDate" type="xs:date" />
<xs:element name="ExecutionTime" type="xs:dateTime" />
<xs:element name="CustomParams" type="xs:boolean" />
<xs:element name="SessionID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExecutionOption" type="xs:short" nillable="true" />
<xs:element name="HistoryID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExportFormat" type="xs:string" default="HTML4.0" />
<xs:element name="DeviceSettings" type="xs:string" nillable="true" />
<xs:element name="RemoteCall" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
<xs:key name="IDKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:ID" />
</xs:key>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
<xs:element name="ReportID" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="NameKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:Name" />
</xs:key>
<xs:keyref name="ReportsParameters" refer="IDKey">
<xs:selector xpath="." />
<xs:field xpath="NS:ReportID" />
</xs:keyref>
</xs:element>
</xs:schema>
 
M

Miha Markic [MVP C#]

You'll see it when you right click on a table row in designer and select
Add/New Key...
or when you right click on a primary key row and pick Edit Key... menu
option.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Ray5531 said:
Where is that check box?

Thanks for your reply.

Miha Markic said:
Hi,

You have to check "Dataset primary key" check box when adding primary
key.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

J-T said:
I have a typed dataset as follows,which as you can see **Dose have a
primary key**.In the application when I try to use the Find mentod on it
it says that the table dosen't have the primary key,so I traced from the
begining of object creation and I noticed when I instanciate an object
from my typedataset (EntityReport m_EntityReport=new EntityReport();)
,there is not primary key definded there!!!!
I used these two lines of code and the length of **test** is Zero!!!
Why?
DataColumn[] test=m_EntityReport.Parameters.PrimaryKey;

Debug.WriteLine(test.Length.ToString());

Thanks a lot

*****************My Typed Dataset Schema***************

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="EntityReport"
targetNamespace="http://www.adventureworks.com/EntityReport.xsd"
elementFormDefault="qualified"
xmlns="http://www.adventureworks.com/EntityReport.xsd"
xmlns:mstns="http://tempuri.org/EntityReport.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:NS="http://www.adventureworks.com/EntityReport.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Description" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="Path" type="xs:string" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="CreatedDate" type="xs:date" />
<xs:element name="ExecutionTime" type="xs:dateTime" />
<xs:element name="CustomParams" type="xs:boolean" />
<xs:element name="SessionID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExecutionOption" type="xs:short" nillable="true" />
<xs:element name="HistoryID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExportFormat" type="xs:string" default="HTML4.0" />
<xs:element name="DeviceSettings" type="xs:string" nillable="true" />
<xs:element name="RemoteCall" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
<xs:key name="IDKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:ID" />
</xs:key>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
<xs:element name="ReportID" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="NameKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:Name" />
</xs:key>
<xs:keyref name="ReportsParameters" refer="IDKey">
<xs:selector xpath="." />
<xs:field xpath="NS:ReportID" />
</xs:keyref>
</xs:element>
</xs:schema>
 
J

J-T

They are both marked as primary key .In the schema code
msdata:primaryKey="true" alos shows that these are the primary keys.

Thanks
Miha Markic said:
You'll see it when you right click on a table row in designer and select
Add/New Key...
or when you right click on a primary key row and pick Edit Key... menu
option.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

Ray5531 said:
Where is that check box?

Thanks for your reply.

Miha Markic said:
Hi,

You have to check "Dataset primary key" check box when adding primary
key.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/
SLODUG - Slovene Developer Users Group www.codezone-si.info

I have a typed dataset as follows,which as you can see **Dose have a
primary key**.In the application when I try to use the Find mentod on it
it says that the table dosen't have the primary key,so I traced from the
begining of object creation and I noticed when I instanciate an object
from my typedataset (EntityReport m_EntityReport=new EntityReport();)
,there is not primary key definded there!!!!
I used these two lines of code and the length of **test** is Zero!!!
Why?
DataColumn[] test=m_EntityReport.Parameters.PrimaryKey;

Debug.WriteLine(test.Length.ToString());

Thanks a lot

*****************My Typed Dataset Schema***************

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="EntityReport"
targetNamespace="http://www.adventureworks.com/EntityReport.xsd"
elementFormDefault="qualified"
xmlns="http://www.adventureworks.com/EntityReport.xsd"
xmlns:mstns="http://tempuri.org/EntityReport.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msprop="urn:schemas-microsoft-com:xml-msprop"
xmlns:NS="http://www.adventureworks.com/EntityReport.xsd"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Report">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" />
<xs:element name="Name" type="xs:string" />
<xs:element name="Description" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="Path" type="xs:string" />
<xs:element name="CreatedBy" type="xs:string" />
<xs:element name="CreatedDate" type="xs:date" />
<xs:element name="ExecutionTime" type="xs:dateTime" />
<xs:element name="CustomParams" type="xs:boolean" />
<xs:element name="SessionID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExecutionOption" type="xs:short" nillable="true"
/>
<xs:element name="HistoryID" type="xs:string" nillable="true"
msprop:nullValue="_null" />
<xs:element name="ExportFormat" type="xs:string" default="HTML4.0"
/>
<xs:element name="DeviceSettings" type="xs:string" nillable="true"
/>
<xs:element name="RemoteCall" type="xs:boolean" />
</xs:sequence>
</xs:complexType>
<xs:key name="IDKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:ID" />
</xs:key>
</xs:element>
<xs:element name="Parameters">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Value" type="xs:string" />
<xs:element name="ReportID" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:key name="NameKey" msdata:primaryKey="true">
<xs:selector xpath="." />
<xs:field xpath="NS:Name" />
</xs:key>
<xs:keyref name="ReportsParameters" refer="IDKey">
<xs:selector xpath="." />
<xs:field xpath="NS:ReportID" />
</xs:keyref>
</xs:element>
</xs:schema>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top