Modifying a Dataset in VB.NET (Clarification)

B

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!
 
M

Marina Levit [MVP]

You cannot use sql syntax. You have to find all the rows you want to change,
and change them.
 
C

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
 
M

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.
 
B

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!
 

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

Top