Forum Discussion

AnthonyShenk's avatar
AnthonyShenk
New Contributor II
3 years ago

Task Activity Type

Our team has been working through an Infrastructure project, which requires pulling task activity from the Framework Database.  When pulled directly from the database, we see task activity type in nu...
  • ckattookaran's avatar
    3 years ago

    Since those are enums, I would take a different approach. Get the data using SQL (add additional columns for descriptions) and edit the data table to get the description.

    e.g, SELECT TaskActivityType, 'Unknown' as TaskActivityTypeDesc FROM TaskActivity

    dim dt as Datatable = (get the table from the SQL above)

    Now, comes the edit part

    dt.Columns("TaskActivityTypeDesc ").ReadOnly = False
    dt.Columns("TaskActivityTypeDesc ").MaxLength = -1
    For Each dr As DataRow In dt.Rows
    	dr.BeginEdit
    		dr("TaskActivityTypeDesc") = TaskActivityType.GetName(GetType(TaskActivityType), dr("TaskActivityType"))
    	dr.EndEdit
    Next

    Done, you can do the same for the other enums similar to this. This way, you are not guessing anything.