Entity Collection help

Posts   
 
    
rai
User
Posts: 41
Joined: 25-Jan-2007
# Posted on: 27-Aug-2007 13:28:41   

I am new to Entity Collection. I am retrieving data into entity collection. now i want to read data from the entity collection...and i dnt know how to do that.

here is the eg. EntityCollection Trans = SubsTrans.GetUnUpdatedRecords(Pubcode); int totalrecords = Trans.Count; int i = 1; while (i < totalrecords) ..... = Trans. ///am stuck here

please help me out.

goose avatar
goose
User
Posts: 392
Joined: 06-Aug-2007
# Posted on: 27-Aug-2007 18:30:32   

Sorry if I didn't get what you meantsimple_smile :

foreach (SubTransEntity yourEntity in Trans)
{
    Console.Wrilteline(yourEntity.anyEntityField);
}

Cheers,

jmeckley
User
Posts: 403
Joined: 05-Jul-2006
# Posted on: 27-Aug-2007 18:35:17   
foreach (IEntity(2) entity in Trans)
{
     entity.Fields["MyField"].CurrentValue;
}

if you use a typed collection then you can access the concrete type specifically

EntityCollection<MyEntity> collection = SubsTrans.GetUnUpdatedRecords(Pubcode);
foreach (MyEntity entity in Trans)
{
     entity.MyField;
}
rai
User
Posts: 41
Joined: 25-Jan-2007
# Posted on: 29-Aug-2007 10:04:13   

jmeckley wrote:

foreach (IEntity(2) entity in Trans)
{
     entity.Fields["MyField"].CurrentValue;
}

if you use a typed collection then you can access the concrete type specifically

EntityCollection<MyEntity> collection = SubsTrans.GetUnUpdatedRecords(Pubcode);
foreach (MyEntity entity in Trans)
{
     entity.MyField;
}

thanks very much for the support. I really appreciate it.