How to check the Field's Data Type in entity object?

Posts   
 
    
maxhe
User
Posts: 2
Joined: 07-Jan-2009
# Posted on: 07-Jan-2009 11:41:47   

the simple is following:


PORequisitionEntity request = new PORequisitionEntity();//is a Entity Generated by Designer IEntityFields2 entityFields=request.Fields; object detailValue="198"; for(int i=0;i<entityFields.Count;i++) { //i want to set the field value when it is int type,but not work and dun know how if (entityFields[updateFldName].DataType is System.Int64) { Int64? int64Value = Convert.ToInt64(detailValue); entityFields[updateFldName].CurrentValue = int64Value; }

}

any one can help me,thank a lot!

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 07-Jan-2009 12:03:40   

Use the ActualDotNetType of the FieldPersistenceInfo object.

Check the following thread for an example on how to get the FieldPersistenceInfo of a specific field. http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=12530

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39859
Joined: 17-Aug-2003
# Posted on: 08-Jan-2009 10:42:22   

Don't set the field's value through CurrentValue, use SetValue on the entity.

Frans Bouma | Lead developer LLBLGen Pro
maxhe
User
Posts: 2
Joined: 07-Jan-2009
# Posted on: 09-Jan-2009 06:03:05   

I have solved my problem,thanks for Walaa and Otis helps!