473,325 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Calling all xsl/ado .net experts!

Hello, just a quick question which I hope has a simple answer...

I have an SP which performs an inner join on 2 tables (User and UserStatus)
and I used the dataset's .GetXml() method to return the following:

<User>
<UserId>1</UserId>
<UserStatusId>1</UserStatusId>
<UserType>1</UserType>
<UserStatusId1>1</UserStatusId1>
<UserStatusName>Logged In</UserStatusName>
</User>

As you can see, as there are 2 UserStatusId columns the 2nd column is
renamed to UserStatusId1. I know I can stop this happening by aliasing the
column names in the SP, but what I want to know is if the following can be
achieved:

<User UserId="1" UserStatusId="1" UserType="1">
<UserStatus UserStatusId="1" UserStatusName="Logged In"/>
</User>

Basically, I want the columns associated with the first table to be
attributes of the 1st node, and I want the columns of the 2nd table to be
attributes of the child node.

Is there a simple way to do this? Or is there a clever XSL transformation
that can be applied?

Many thanks.
Nov 15 '05 #1
1 1027
The SP could perform a FOR XML EXPLICIT query ... which shouldn't be too
hard in your case. Look at [0] or the Books Online doc that's installed with
SQLXML.

If you app permits, you might also be able to load the two tables into the
DataSet, set the ColumnMapping Property on the DataColumns to
MappingType.Attribute and setup a DataRelation between the two tables.

--
HTH
Christoph Schittko [MVP, XmlInsider]
Software Architect, .NET Mentor

[0] http://www.topxml.com/sql/for_xml_explicit.asp

"suzy" <me@nospam.com> wrote in message
news:OW**************@TK2MSFTNGP11.phx.gbl...
Hello, just a quick question which I hope has a simple answer...

I have an SP which performs an inner join on 2 tables (User and UserStatus) and I used the dataset's .GetXml() method to return the following:

<User>
<UserId>1</UserId>
<UserStatusId>1</UserStatusId>
<UserType>1</UserType>
<UserStatusId1>1</UserStatusId1>
<UserStatusName>Logged In</UserStatusName>
</User>

As you can see, as there are 2 UserStatusId columns the 2nd column is
renamed to UserStatusId1. I know I can stop this happening by aliasing the column names in the SP, but what I want to know is if the following can be
achieved:

<User UserId="1" UserStatusId="1" UserType="1">
<UserStatus UserStatusId="1" UserStatusName="Logged In"/>
</User>

Basically, I want the columns associated with the first table to be
attributes of the 1st node, and I want the columns of the 2nd table to be
attributes of the child node.

Is there a simple way to do this? Or is there a clever XSL transformation that can be applied?

Many thanks.

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Gonçalo Rodrigues | last post by:
Hi all, Is it possible to call a constructor of a class, call it Object, explicitely? e.g. suppose you have a void pointer ptr pointing to a block of memory big-enough to hold an Object. Is...
1
by: Friends | last post by:
Hello sir, I have a problem in calling a exe from client machine.. This is my Problem there is an exe in client machine i need to call the exe from web page..In that page there will be button if I...
4
by: Gibby Koldenhof | last post by:
Hiya, I'm setting up some code in the spirit of Design Patterns, OOP, etc. All nice and well, it handles pretty much all OO style things and serves my purposes well. There's one last final...
2
by: srinivasreddypn | last post by:
Hi, Hello experts! please let me know how to develop graphs in flash by calling XML's data into flash. If you have any examples of graphs in flash using xml data, please provide it to me. Any...
13
by: Steve | last post by:
On page 392 of "Javascript the definitive guide" a function is called like this:- <form action="processform.cgi" onsubmit="return validateForm();"> Why, in this instance, is the return...
12
by: kid joe | last post by:
Hi I am porting an old 32 bit application that uses thunking to call a 16bit DLL under Win32s. The application uses functionality provided by a custom 16 bit DLL (there is no 32 bit version). ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.