.NETGURU
dataset
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-sqlclient' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

renevazquez@cimex.com.cu
-- Moved from [aspngfreeforall] to [ngfx-sqlclient] by Tim Musschoot <Click here to reveal e-mail address> --

Hi, I am populating a dataset that contains two tables and I use two
dataadapters and two stored procedures to populate each of the tables.

the stored procedures are these:

CREATE PROCEDURE dbo.getRMAs
AS

SET NOCOUNT ON;
SELECT* FROM RMA
GO

and

CREATE PROCEDURE dbo.getRMADetails
AS

SET NOCOUNT ON;
SELECT* FROM RMADetails
GO

I call the fill method of each data adapter and my dataset fills with
data but when I get the xml representation of the dataset I obtain
this:

<dsRMA>
<Table>
<RMAId>4</RMAId>
<descr>test</descr>
<configNo>1</configNo>
<serialNo>1</serialNo>
<userId>rene</userId>
<saleOrdNo>1</saleOrdNo>
</Table>
<Table>
<RMAId>4</RMAId>
<RMADetailId>1</RMADetailId>
<partNo>x1</partNo>
<qtty>2</qtty>
<failId>1</failId>
<repairId>1</repairId>
</Table>
<Table>
<RMAId>4</RMAId>
<RMADetailId>2</RMADetailId>
<partNo>x2</partNo>
<qtty>1</qtty>
<failId>1</failId>
<repairId>1</repairId>
</Table>
</dsRMA>
</xml>

i wish that my xml were returned with the following structure:

<dsRMA>
<Table>
<RMAId>4</RMAId>
<descr>test</descr>
<configNo>1</configNo>
<serialNo>1</serialNo>
<userId>rene</userId>
<saleOrdNo>1</saleOrdNo>
<RMADetail>
<RMADetailId>1</RMADetailId>
<partNo>x1</partNo>
<qtty>2</qtty>
<failId>1</failId>
<repairId>1</repairId>
</RMADetail>
<RMADetail>
<RMADetailId>2</RMADetailId>
<partNo>x2</partNo>
<qtty>1</qtty>
<failId>1</failId>
<repairId>1</repairId>

</RMADetail>
</dsRMA>
</xml>

my question is how can I make that my xml adjust to the xsd definition
of the dataset wich is these:

- <xs:element name="dsRMA" msdata:IsDataSet="true">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="RMA">
- <xs:complexType>
- <xs:sequence>
<xs:element name="RMAId" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="descr" type="xs:string" />
<xs:element name="configNo" type="xs:string" />
<xs:element name="serialNo" type="xs:string" />
<xs:element name="userId" type="xs:string" />
<xs:element name="saleOrdNo" type="xs:string" minOccurs="0" />
- <xs:element name="RMADetails">
- <xs:complexType>
- <xs:sequence>
<xs:element name="RMADetailId" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="RMAId" type="xs:int" />
<xs:element name="partNo" type="xs:string" />
<xs:element name="qtty" type="xs:int" />
<xs:element name="failId" type="xs:int" />
<xs:element name="repairId" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
- <xs:key name="RMAId" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:RMA" />
<xs:field xpath="mstns:RMAId" />
</xs:key>
- <xs:key name="RMADetailId" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMADetailId" />
</xs:key>
- <xs:key name="key1">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMAId" />
</xs:key>
- <xs:keyref name="RMARMADetails" refer="RMAId"
msdata:ConstraintOnly="true">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMAId" />
</xs:keyref>
</xs:element>
</xs:schema>

Reply to this message...
 
    
Tim Musschoot
Hello,

I have no experience with the sql representation, but if you want to combine
data from different tables, you'll have to perform a join operation.

CREATE PROCEDURE dbo.getRMAandDetails
AS
SET NOCOUNT ON;
SELECT* FROM RMA, RMADETAILS
    WHERE <joinconditions>
GO

Otherwise you just merge to different datasets with no relationship between
them.

Best Regards,
Tim Musschoot
AspFriends Moderation Team
Click here to reveal e-mail address
http://www.aspalliance.com/tim_musschoot

-----Oorspronkelijk bericht-----
Van: Click here to reveal e-mail address [mailto:Click here to reveal e-mail address]
Verzonden: vrijdag 14 juni 2002 23:40
Aan: ngfx-sqlclient
Onderwerp: [ngfx-sqlclient] dataset

-- Moved from [aspngfreeforall] to [ngfx-sqlclient] by Tim Musschoot
<Click here to reveal e-mail address> --

Hi, I am populating a dataset that contains two tables and I use two
dataadapters and two stored procedures to populate each of the tables.

the stored procedures are these:

CREATE PROCEDURE dbo.getRMAs
AS

SET NOCOUNT ON;
SELECT* FROM RMA
GO

and

CREATE PROCEDURE dbo.getRMADetails
AS

SET NOCOUNT ON;
SELECT* FROM RMADetails
GO

I call the fill method of each data adapter and my dataset fills with
data but when I get the xml representation of the dataset I obtain
this:

<dsRMA>
<Table>
<RMAId>4</RMAId>
<descr>test</descr>
<configNo>1</configNo>
<serialNo>1</serialNo>
<userId>rene</userId>
<saleOrdNo>1</saleOrdNo>
</Table>
<Table>
<RMAId>4</RMAId>
<RMADetailId>1</RMADetailId>
<partNo>x1</partNo>
<qtty>2</qtty>
<failId>1</failId>
<repairId>1</repairId>
</Table>
<Table>
<RMAId>4</RMAId>
<RMADetailId>2</RMADetailId>
<partNo>x2</partNo>
<qtty>1</qtty>
<failId>1</failId>
<repairId>1</repairId>
</Table>
</dsRMA>
</xml>

i wish that my xml were returned with the following structure:

<dsRMA>
<Table>
<RMAId>4</RMAId>
<descr>test</descr>
<configNo>1</configNo>
<serialNo>1</serialNo>
<userId>rene</userId>
<saleOrdNo>1</saleOrdNo>
<RMADetail>
<RMADetailId>1</RMADetailId>
<partNo>x1</partNo>
<qtty>2</qtty>
<failId>1</failId>
<repairId>1</repairId>
</RMADetail>
<RMADetail>
<RMADetailId>2</RMADetailId>
<partNo>x2</partNo>
<qtty>1</qtty>
<failId>1</failId>
<repairId>1</repairId>

</RMADetail>
</dsRMA>
</xml>

my question is how can I make that my xml adjust to the xsd definition
of the dataset wich is these:

- <xs:element name="dsRMA" msdata:IsDataSet="true">
- <xs:complexType>
- <xs:choice maxOccurs="unbounded">
- <xs:element name="RMA">
- <xs:complexType>
- <xs:sequence>
<xs:element name="RMAId" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="descr" type="xs:string" />
<xs:element name="configNo" type="xs:string" />
<xs:element name="serialNo" type="xs:string" />
<xs:element name="userId" type="xs:string" />
<xs:element name="saleOrdNo" type="xs:string" minOccurs="0" />
- <xs:element name="RMADetails">
- <xs:complexType>
- <xs:sequence>
<xs:element name="RMADetailId" msdata:ReadOnly="true"
msdata:AutoIncrement="true" type="xs:int" />
<xs:element name="RMAId" type="xs:int" />
<xs:element name="partNo" type="xs:string" />
<xs:element name="qtty" type="xs:int" />
<xs:element name="failId" type="xs:int" />
<xs:element name="repairId" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
- <xs:key name="RMAId" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:RMA" />
<xs:field xpath="mstns:RMAId" />
</xs:key>
- <xs:key name="RMADetailId" msdata:PrimaryKey="true">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMADetailId" />
</xs:key>
- <xs:key name="key1">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMAId" />
</xs:key>
- <xs:keyref name="RMARMADetails" refer="RMAId"
msdata:ConstraintOnly="true">
<xs:selector xpath=".//mstns:RMADetails" />
<xs:field xpath="mstns:RMAId" />
</xs:keyref>
</xs:element>
</xs:schema>

| [ngfx-sqlclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-sqlclient.asp = JOIN/QUIT

Reply to this message...
 
    
Douglas Reilly (VIP)
I do not know what the XML representation would be, but when using related
data such as these in the dataset, you might want to try creating a
DataRelation and see what the XML looks like. I have used Data Relations,
but not to create XML...

Doug Reilly
Designing Microsoft(r) ASP.NET Applications
http://www.programmingasp.net

----- Original Message -----
From: "Tim Musschoot" <Click here to reveal e-mail address>
To: "ngfx-sqlclient" <Click here to reveal e-mail address>
Sent: Tuesday, June 18, 2002 6:16 PM
Subject: [ngfx-sqlclient] RE: dataset

[Original message clipped]

Reply to this message...
 
 
System.Data.DataRelation




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification