473,624 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML from SQL or from DataSet - Design Question!

PCC
I am writing a data access layer for a web service. Data from the web
service is to be returned as XML. My design dilemma is this...

Should I be returning XML from my stored procedures using the "for xml"
clause or loading the data into a DataSet in the data access layer and then
outputting XML from the dataset as the response? All my sprocs are simple
CRUD spocs just to keep maintenance easy.

My own bias is to output XML from the DataSet after I have loaded it in from
the sproc. That said, my real question is if I am not really doing anything
with the data until it ends up in a DataSet within the Business Object
Layer, why should I bother to load it into a DataSet in the Data Access
Layer and then serialize it as XML when I can get XML string from the
database?

You can tell I am a little lost and confused here. You advice is greatly
appreciated. I know how to do both, but am not sure which is best in the
long run. Thank you.
Nov 15 '05 #1
1 1500
Hi PCC,
A very interesting design decision indeed. Here's my
$0.02 -
I've used both ways in different projects too.A couple of
things that you might want to consider :

1)What is the format of the XML data expected by the
client? Do you have complete freedom to define the
expected schema the way you want or should it conform to a
particular specification? Converting the Dataset to XML
generates alot of extra XML stuff that you might not
really need and you might want to think of using an XSL.
IF that does happen, then it might help to use a SQL
template at the DB level and apply the XSL there. Of
course SQL Managed clases also guve you the ability to do
all this on the clent-side if server load is a concern.

2) If you are absolutely sure that all u need to output is
XML, then why use a dataset? Why not just use
SqlXmlcommand.E xecuteXmlReader to get the XML stream back?

3) If you think that at some point of time you might need
to use the data to perform databinding using ASP.NET
controls etc., then it makes sense to stick to using a
dataset (the other option of course is using XML data
islands on IE client-side OR using an XML deserializer to
create an object out of your XML OR rad in the XML in the
dataset I guess :-))
-----Original Message-----
I am writing a data access layer for a web service. Data from the webservice is to be returned as XML. My design dilemma is this...
Should I be returning XML from my stored procedures using the "for xml"clause or loading the data into a DataSet in the data access layer and thenoutputting XML from the dataset as the response? All my sprocs are simpleCRUD spocs just to keep maintenance easy.

My own bias is to output XML from the DataSet after I have loaded it in fromthe sproc. That said, my real question is if I am not really doing anythingwith the data until it ends up in a DataSet within the Business ObjectLayer, why should I bother to load it into a DataSet in the Data AccessLayer and then serialize it as XML when I can get XML string from thedatabase?

You can tell I am a little lost and confused here. You advice is greatlyappreciated. I know how to do both, but am not sure which is best in thelong run. Thank you.
.

Nov 15 '05 #2

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

Similar topics

3
2537
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
0
273
by: Mike | last post by:
Hi, I am trying to solve a problem with a DataSet issue I am having. In my app the user selects certain options and based on those options it goes out to the db to get data based on those options. This data will be used in different Business Objects (Business Rules and Reporting). I have decided to use DataSets as the data container because the data is dyncamic and will change based on user selections which I could not simulate in a...
3
15522
by: redneon | last post by:
I've populated a DataSet in my C# program and verified that it contains the data I passed it. I've then created a blank CrystalReport and set it's DataSource to my DataSet. Then I created a CrystalReportViewer and set it's ReportSource to my CrystalReport. When I run the program though nothing get's shown in my viewer. The following is how I did it... OdbcConnection dbConn = new OdbcConnection(); OdbcCommand dbCommand = new...
5
14764
by: Karl | last post by:
Hi C# experts, I am to C# and .NET. I am writing a database application using C# and Dataset. In Sql server, I have a Acount table which contains over 100,000 records. This table will be accessed and updated by many users at same time. So the data in this table keeps changing and growning. I want to keep each user's local Dataset updated every time he does a update or does a query. My code is like this:
1
1423
by: stormogulen | last post by:
Hi! I'm hoping someone can help me come up with a 'best possible solution' for the following problem: I'm trying to design an addressbook, i.e a storage for adresses. I would like my adresses to have a random number of fields, all of which are strings. Futhermore every address can belong to zero or more categories (ie. friend, family etc.)
1
2340
by: Keith | last post by:
Hi, I created a dataset during run time and assigned it to the datagrid. But i cant get the FindBy<Key> method to work. During design time, i got a error "dtProdHdr is not a member of System.Data.DataSet" error Is it that FindBy<Key> method is used only for DataSet generated during design time by the wizard? Can i actually use FindBy<Key> method if i am using a design time created dataset?
3
2688
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to populate multiple webpages containing customer information. There isn't a one-to-one correlation between the stored procedure and a webpage. In other words, a webpage may have to refer to 1 or more DataTables to populate itself. Therefore, a...
4
4203
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE during design-time. Here is the design of my simple tables: (An example since I can't post my...
5
1399
by: Mark Olbert | last post by:
I'm starting to play around with VS2005 and ASP.NET 2 and have some questions. The typical pattern for a data-driven aspx page in v1.1 was data connection -> data adapter -> dataset -> bound controls. V2 (at least by default) doesn't include data connections, data adapters or datasets in the toolbox when building an aspx page. Nor can I find where the DataView component went to. Everything now seems to rely on the DataSource controls. ...
0
8240
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4177
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.