Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Temporary, non SQL, free table 1

Status
Not open for further replies.

florindaniel

Programmer
Dec 4, 2009
120
RO
Hello,

I need some sort of simple, non SQL based tables to be used temporary in a C# App.
I just need to create them (with 3 or 4 fields), populate them from a text file, have some statistics
based on some index field and then discard them.
Is there such a mechanism ?

Thank you,
Daniel
 
If the text file will always have the same structure, you could design a DataSet that will hold the data. Then you would read the file, split the data and add it to the DataSet.

Another way to do this would be to create a class that has all of the fields from the data. You would read the data into an object of that class. If there is more than one row, you would add each object to a List of objects of that class and then continue your processing.

I have used both of the methods on various projects.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
Thank you, Dell

I'll go with DataSet.

Does it have Seek / Locate mechanism?

Thank you,
Daniel
 
Yes, it does. If you pre-define a DataTable in your DataSet, you can indicate which fields are keys and VS will automatically create "Find" methods for those keys. If you don't want to do that, you can use the Select() method of a DataTable to find data based on a selection formula. The code for this will look something like this:

groups = dsAuditInfo.reportSecTable.Select(string.Format("reportID = {0}",myReportID));

-Dell



DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top