|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Modifying a Dataset in VB.NET (Clarification)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! 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! > 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! > 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! >> > > |
|||||||||||||||||||||||