sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
suzy's Avatar

very simple question, but i cant find the answer


Question posted by: suzy (Guest) on November 12th, 2005 03:04 AM
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.






3 Answers Posted
Marina's Avatar
Guest - n/a Posts
#2: Re: very simple question, but i cant find the answer

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.

"suzy" <suzy@spam.com> wrote in message
news:iuG1c.7728$Kc6.6158@news-binary.blueyonder.co.uk...[color=blue]
> 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[/color]
this[color=blue]
> 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[/color]
be[color=blue]
> many rows that have been updated, so the data adapter can be used to[/color]
filter[color=blue]
> 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,[/color]
so[color=blue]
> should i just use a simple command object to build a query and update the[/color]
db[color=blue]
> 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.
>
>
>
>
>
>[/color]


David Schleifer [MSFT]'s Avatar
David Schleifer [MSFT] November 12th, 2005 03:04 AM
Guest - n/a Posts
#3: Re: very simple question, but i cant find the answer

In regards to your question
[color=blue]
> when creating/updating data i was thinking of using a data adapter but[/color]
this[color=blue]
> 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[/color]
be[color=blue]
> many rows that have been updated, so the data adapter can be used to[/color]
filter[color=blue]
> out the rows that have changed and update the db.[/color]

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

"suzy" <suzy@spam.com> wrote in message
news:iuG1c.7728$Kc6.6158@news-binary.blueyonder.co.uk...[color=blue]
> 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[/color]
this[color=blue]
> 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[/color]
be[color=blue]
> many rows that have been updated, so the data adapter can be used to[/color]
filter[color=blue]
> 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,[/color]
so[color=blue]
> should i just use a simple command object to build a query and update the[/color]
db[color=blue]
> 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.
>
>
>
>
>
>[/color]


suzy's Avatar
Guest - n/a Posts
#4: Re: very simple question, but i cant find the answer

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

"David Schleifer [MSFT]" <dschleif@microsoft.com> wrote in message
news:OTvXMBlAEHA.3400@tk2msftngp13.phx.gbl...[color=blue]
> In regards to your question
>[color=green]
> > when creating/updating data i was thinking of using a data adapter but[/color]
> this[color=green]
> > seems a bit over the top, maybe i am wrong? should a data adapter be[/color][/color]
used[color=blue][color=green]
> > when doing bulk updates? For example, when editing a data grid there[/color][/color]
may[color=blue]
> be[color=green]
> > many rows that have been updated, so the data adapter can be used to[/color]
> filter[color=green]
> > out the rows that have changed and update the db.[/color]
>
> One thing to be careful of is that for the 1.0 and 1.1 releases of .NET,[/color]
the[color=blue]
> 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
>
> "suzy" <suzy@spam.com> wrote in message
> news:iuG1c.7728$Kc6.6158@news-binary.blueyonder.co.uk...[color=green]
> > 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[/color][/color]
from[color=blue][color=green]
> > my asp.net pages to talk to my db. by the way, i want the results of[/color][/color]
any[color=blue][color=green]
> > 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[/color][/color]
data?[color=blue][color=green]
> > 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[/color]
> this[color=green]
> > seems a bit over the top, maybe i am wrong? should a data adapter be[/color][/color]
used[color=blue][color=green]
> > when doing bulk updates? For example, when editing a data grid there[/color][/color]
may[color=blue]
> be[color=green]
> > many rows that have been updated, so the data adapter can be used to[/color]
> filter[color=green]
> > 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,[/color]
> so[color=green]
> > should i just use a simple command object to build a query and update[/color][/color]
the[color=blue]
> db[color=green]
> > like that?
> >
> > i hope i have made myself clear in what i am trying to acheive and what[/color][/color]
my[color=blue][color=green]
> > concerns are. i am new to ado.net so i am just trying to find out the[/color][/color]
best[color=blue][color=green]
> > way of doing things.
> >
> > many thanks.
> >
> >
> >
> >
> >
> >[/color]
>
>[/color]


 
Not the answer you were looking for? Post your question . . .
196,848 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,848 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors