JimWarner
asked on
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.
If this tack won't work, I am open to other ideas to accomplish the goal of producing that Due Date column.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect! You're my hero.
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