SEt the value before you add it... and you'll need to use
a function to handle the addition.
Situation 1: Server Side...adjust your query ie DateAdd
(d, 50, oldDate)
Then you don't have to do anything client side...
Situation 2: Client side, more than a few ways but this
should give you the idea...
http://www.devhood.com/messages/message_view-2.aspx?
thread_id=71480
Remember one thing about Dates. On SQL Server and most
other DB's, there's no real Date Type.... It's DateTime,
and it's actually a long. If you look at the values a
LONG can hold, you'll see why January 1, 0001 is a valid
date but you can't query on it if it's a datetime field
in SQL Server. Int's and Long's don't play well together
in date math...
Anyway, this should do it for you, but just make sure you
use proper data arithmatic.
Good Luck,
Bill
Cordially,
W.G. Ryan
(E-Mail Removed)
www.knowdotnet.com
>-----Original Message-----
>I am adding an expression column to a datatable. The
>column is a DateTime and I am attempting to add x number
>of days to it. Below is the syntax where dt is the
>datatable
>
>dt.Columns.Add("NewDate",System.Type.GetType
>("System.DateTime"),"OldDate + 50");
>
>When I do this I get an error saying it can't add
DateTime
>and Int. Does anyone have any ideas as to how to
>accomplish this?
>.
>