names of database columns

Posts   
 
    
morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 27-Apr-2009 01:09:07   

can I get the name of a column by using the selfserving layer?

Something like []Entity.ColumnNames.[NameOfSpecificColumn]

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Apr-2009 03:43:50   

This way you obtain a IEntityField object:

someEntity.Fields["FieldName"]

Now, when you say "NameOfSpecificColumn" do you mean the source db field name or the llblgen mapped field name?

David Elizondo | LLBLGen Support Team
morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 27-Apr-2009 09:50:29   

daelmo wrote:

This way you obtain a IEntityField object:

someEntity.Fields["FieldName"]

Now, when you say "NameOfSpecificColumn" do you mean the source db field name or the llblgen mapped field name?

I'd like to be able to access the name of the source database column.

What I essentially would like to do is something like this:

myDropDownList.DataSource = x myDropDownList.DataValueField = MyEntity.ValueFieldColomnName myDropDownList.DataTextField = MyEntity.TextFieldColomnName myDropDownList.DataBind()

instead of this:

myDropDownList.DataSource = x myDropDownList.DataValueField = "ValueFieldName" myDropDownList.DataTextField = "TextFieldName" myDropDownList.DataBind()

This way the code would fail at design-time, if the source column name changes. If there is a more clever way to handle such situations, I'm all ears.

/Morten

morten71
User
Posts: 80
Joined: 13-Jan-2009
# Posted on: 27-Apr-2009 13:26:10   

I think I found out how:

Imports myProject.DLL.HelperClasses

[TABLE]Fields.[ColumnName]