Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scanning tables
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Environment versions
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01184007
Message ID:
01184038
Views:
23
This message has been marked as a message which has helped to the initial question of the thread.
>I am still struggling to figure out the best way to cycle through a table when I need to look at just certain fields, use some values to look up other values and create an export text file. I'm feeling a bit dense. I haven't figured out how to just go to the next record using the entity object. The table doesn't really have a primary key and I wouldn't want to use it if it did, since I have to look at every record and wouldn't know the key without scanning t he table. I'm currently using a reader but it is more verbose and each field has to be converted to a type. I can make it work but it's a bit of a nuisance. Any suggestions for the best way to do this?
>
>Thanks.

It's kind of hard to say from that description, but you could just retrieve a dataset with your info then use a foreach to iterate through the rows of the table(s) in it. (I can't test this code right now, but something like this should work):
// Assuming ds contains your dataset
DataTable table = ds["TableName"];
BusinessObjectEntity objectEntity = new BusinessObjectEntity();

foreach(DataRow row in table.Rows)
{
   objectEntity.SetDataRow(row);
   // Now you can access the objectEntity object which has the data  
   // for the current row.
}
You could also use the Select() method of your DataTable object to filter it down a bit more if necessary (it returns an array of Rows, which you can also iterate through using a foreach).
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform