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




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com