Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to select a field by name
Message
De
29/08/2012 13:29:09
 
 
À
29/08/2012 03:44:09
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Divers
Thread ID:
01551564
Message ID:
01551846
Vues:
64
I've implemented the plan with a Dictionary, and it works as I need.

The reason that I'm using DataSets is that the resulting XML files will be used to populate both VFP .dbfs and SQL Server tables. So the table model seems to be the most intuitive way to approach the problem.

Thanks to all.

>If I understand correctly then my suggestion should work ( but maybe tweaking the Linq query if you need a specific row). As Bonnie suggests a Dictionary is also a possibility - but if the number of 'cached' rows is relatively small then a List would be lighter and also fast enough.
>
>Of course that begs the question of why, if you are moving raw data to XML, you are using datasets at all :-}
>
>>Here's what I'm trying to accomplish: an object (A) contains raw data that needs to be processed and stored in tables. Note that I'm planning on exporting these tables to XML, rather than using SQL Server or something similar. These tables are in a subclassed DataSet. Each column of a table's DataRow is calculated in order, but some of these calculations are dependent on the results of previous columns, either in the DataRow or the matching DataRow of previously processed DataTables. So what I was thinking would work would be this: at the beginning of processing of a particular table, stash its DataRow in A so that anything contained in it is available to a subsequent calculation, whether it is the current DataRow or one from a previously processed table.
>>
>>The actual storage method of the DataRow repository doesn't matter to me - perhaps a dictionary with the name of the DataRow's table as the key and the DataRow as the value would work.
>>
>>Comments?
>>
>>David
>>
>>
>>>Or am I going about this the wrong way?
>>>Probably :-}
>>>Maybe you could use a collection:
>>>public class MyClass()
>>>{ 
>>>     List<DataRow> stachedRows = new List<DataRow>();
>>>
>>>    public void AssignRow(DataRow input)
>>>    {
>>>           stachedRows.Add(input);
>>>    }
>>>
>>>   //To get rows for a specific table:
>>>
>>>   public IEnumerable<DataRow> GetRowsFromTable(string tablename)
>>>  {
>>>         return stachedRows.Where(x=>x.Table.TableName==tablename);
>>>  }
>>>
>>>}
David M. Stowell
Ravenslake Consulting
Chicago, Illinois

e-mail: davidstowell@ravenslakeconsulting.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform