very simple question, but i cant find the answer

S

suzy

Hello,

I am trying to write a generic tool that accesses a SQL server and
reads/updates/deletes/creates records. I want to reference this tool from
my asp.net pages to talk to my db. by the way, i want the results of any
read, update and create to be returned in xml.

when reading data, i populate a dataset with data and then use the
dataset.getxml method to return xml. is this a neat way of reading data?
how does it compare to the FOR XML EXPLICIT command in sql server?

when creating/updating data i was thinking of using a data adapter but this
seems a bit over the top, maybe i am wrong? should a data adapter be used
when doing bulk updates? For example, when editing a data grid there may be
many rows that have been updated, so the data adapter can be used to filter
out the rows that have changed and update the db.

For my scenario i will probably only be updating a single row at a time, so
should i just use a simple command object to build a query and update the db
like that?

i hope i have made myself clear in what i am trying to acheive and what my
concerns are. i am new to ado.net so i am just trying to find out the best
way of doing things.

many thanks.
 
M

Marina

The 2 xml methods are not related. Calling GetXml on the dataset is just a
way to get the data in the dataset in XML form. But the data is already
there. In fact, you don't know how it got there - it could have been added
there manually, or populated from a text file.

If you have many rows that needs to be updated/inserted/deleted, a data
adapter may be the way to go. If it's just 1 row, it might be cleaner to
just construct the SQL and execute the query.
 
D

David Schleifer [MSFT]

In regards to your question
when creating/updating data i was thinking of using a data adapter but this
seems a bit over the top, maybe i am wrong? should a data adapter be used
when doing bulk updates? For example, when editing a data grid there may be
many rows that have been updated, so the data adapter can be used to filter
out the rows that have changed and update the db.

One thing to be careful of is that for the 1.0 and 1.1 releases of .NET, the
data adapter will take a seperate round trip for each changed row. This
might be fine for propagating the changes made to a data grid, but if you
have too many rows that have been changed you could get into trouble.

- Dave
 
S

suzy

Aha, I never knew that. That's even more reason for me NOT to use the
dataadapter for my situation :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top