Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Will eTecnologia succeed?
Message
 
À
02/03/2009 14:34:18
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01383209
Message ID:
01385065
Vues:
85
>as a table or "table" (whatever), but if you don't it's a... what? A collection of objects with one property per field? Or a collection of records, where each record is a collection of field objects? How do you apply something to a column (as in "replace all field4 with [goodbye]"), or how do you relate the records?

A DataSet is a collection of DataTables and info. about any relationships you might want to set up between them. A DataTable is a collection of Row objects. You can apply things to all columns by looping through the rows in a foreach and setting the value. Or you could use LINQ to apply the values.
DataTable table = ds.Tables[0];
table.AsEnumerable().Where(currentRow => true).ToList().ForEach(item => item.SetField("field4", "goodbye"));
You don't really need the Where clause, I just included it there to show that you can do some evaluting to filter the result. If that's a bit wordy it's easy to add extension methods to shorten things up (ex. add something like a Replace() method on a DataTable that lets you pass in the filter, field, and values).
-Paul

RCS Solutions, Inc.
Blog
Twitter
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform