473,378 Members | 1,380 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,378 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 12 '05 #1
1 1101
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 12 '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). ...
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...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.