Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / ADO.NET / May 2005

Tip: Looking for answers? Try searching our database.

TypedDataset

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J-T - 24 May 2005 01:12 GMT
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>
Miha Markic [MVP C#] - 24 May 2005 08:49 GMT
Hi,

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

Signature

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
[quoted text clipped - 66 lines]
> </xs:element>
> </xs:schema>
Ray5531 - 24 May 2005 09:04 GMT
Where is that check box?

Thanks for your reply.

> Hi,
>
[quoted text clipped - 70 lines]
>> </xs:element>
>> </xs:schema>
Miha Markic [MVP C#] - 24 May 2005 13:55 GMT
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.

Signature

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

> Where is that check box?
>
[quoted text clipped - 76 lines]
>>> </xs:element>
>>> </xs:schema>
J-T - 25 May 2005 17:31 GMT
They are both marked as primary key .In the schema code
msdata:PrimaryKey="true" alos shows that these are the primary keys.

Thanks
> You'll see it when you right click on a table row in designer and select
> Add/New Key...
[quoted text clipped - 84 lines]
>>>> </xs:element>
>>>> </xs:schema>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.