Adding DateTime Values in a Calculated Column of Dataset

I am trying to add a calculated  "Due Date" column to a dataset using the expression property, but I am having trouble with the syntax.  Due date needs to be calculated by subtracting a "Lead Time" field from a "Launch Date" field - both of which are on the same row as Due Date.  The root problem is that the lead time is an integer and the launch date is a DateTime, so I can't simply add them.   I'd expect to be able to use the AddDays method of a DateTime to easily add them together, but I can't figure out how to use the method within the Expression syntax.

If this tack won't work, I am open to other ideas to accomplish the goal of producing that Due Date column.  
LVL 3
JimWarnerInstructorAsked:
Who is Participating?
 
YZlatConnect With a Mentor Commented:
actually if you need to subtract the integer from the Launch date, use

ds.Tables(0).Columns.Add(New DataColumn("Due Date"))

        For Each dr As DataRow In ds.Tables(0).Rows
            dr("Due Date") = DateAdd(DateInterval.Day, (-1) * Convert.ToDouble(dr("Lead Time")), dr("Launch Date"))
        Next
0
 
YZlatCommented:
ds.Tables(0).Columns.Add(New DataColumn("Due Date"))

        For Each dr As DataRow In ds.Tables(0).Rows
            dr("Due Date") = DateAdd(DateInterval.Day, Convert.ToDouble(dr("Lead Time")), dr("Launch Date"))
        Next
0
 
JimWarnerInstructorAuthor Commented:
Perfect!  You're my hero.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.