Home All Groups Group Topic Archive Search About

Modifying a Dataset in VB.NET (Clarification)

Author
15 May 2006 2:36 PM
Bmack500
I have code which needs to make several modification to data. If I set
up a Dataset, fill it w/data from a data-adapter, is there any way to
modify the dataset results using sql syntax? Or do I have to iterate
through the datatables and modify the rows one at a time?

Thanks in advance!

Author
15 May 2006 2:46 PM
Marina Levit [MVP]
You cannot use sql syntax. You have to find all the rows you want to change,
and change them.

Show quote
"Bmack500" <brett.m***@gmail.com> wrote in message
news:1147703780.281745.174390@j33g2000cwa.googlegroups.com...
>I have code which needs to make several modification to data. If I set
> up a Dataset, fill it w/data from a data-adapter, is there any way to
> modify the dataset results using sql syntax? Or do I have to iterate
> through the datatables and modify the rows one at a time?
>
> Thanks in advance!
>
Author
15 May 2006 2:48 PM
Bmack500
Bummer. Thanks!
Author
15 May 2006 3:49 PM
Cor Ligthert [MVP]
Bmack,

I assume that Marina did read your message in another way than I did.

To update the dataset you need to set the right SQL commands in the
DataAdapter properties for it.

There is beside the one for Select (command)
one for Update, one for Insert and one for Delete. Know that you beside the
update command has as well to create a Select in it those to read the data
and check that on changed values with your original rows in the dataset or
that an Insert is not created as new meanwhile.

Those SQL commands can be avoided by using the commandbuilder or the
designer to build those for you.

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx

I hope this helps,

Cor

Show quote
"Bmack500" <brett.m***@gmail.com> schreef in bericht
news:1147704522.513158.49500@i39g2000cwa.googlegroups.com...
> Bummer. Thanks!
>
Author
15 May 2006 3:52 PM
Marina Levit [MVP]
Yes, I read it as needing to modify the rows in memory, and wanting to use a
SQL like syntax.

Good point though Cor, maybe he meant updating them in the database.

Show quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:OEkIubDeGHA.4720@TK2MSFTNGP03.phx.gbl...
> Bmack,
>
> I assume that Marina did read your message in another way than I did.
>
> To update the dataset you need to set the right SQL commands in the
> DataAdapter properties for it.
>
> There is beside the one for Select (command)
> one for Update, one for Insert and one for Delete. Know that you beside
> the update command has as well to create a Select in it those to read the
> data and check that on changed values with your original rows in the
> dataset or that an Insert is not created as new meanwhile.
>
> Those SQL commands can be avoided by using the commandbuilder or the
> designer to build those for you.
>
> http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlcommandbuilder.aspx
>
> I hope this helps,
>
> Cor
>
> "Bmack500" <brett.m***@gmail.com> schreef in bericht
> news:1147704522.513158.49500@i39g2000cwa.googlegroups.com...
>> Bummer. Thanks!
>>
>
>
Author
19 May 2006 1:28 PM
Bmack500
Thanks, but Marina read it correctly. I've got a data adapter to update
the original data, I wanted to modify the in-memory items with sql
syntax. It would be really convenient... but I've found another way.
Thanks!

AddThis Social Bookmark Button