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" msdatarimaryKey="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" msdatarimaryKey="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>
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" msdatarimaryKey="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" msdatarimaryKey="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>