Hi Joe.
Sorry, as Cor said, I'm afraid the expression column in Ado.net can't
provide this feature for you.
I have tried to substring the date filed and time filed, and then combined
them to new datetime filed.
Such as:
Columns.Add("realyDate", typeof(System.DateTime),
@"SubString(CONVERT(date,System.String),1,10)+'
'+SubString(CONVERT(date,System.String),12,19)");
But this methond can not work fine with "2003/03/03". Datetime typed column
will shorten it as "2003/3/3". For this reason, I failed to substring date.
The only way to achive this is you should have to modify the query command.
Convert date and time to nvarchar as "yyyy-mm-ddThh:mm:ss.mmm"
Such as (in SQL database):
SqlDataAdapter ada = new SqlDataAdapter("select
c1,convert(nvarchar,date,126) as date ,convert(nvarchar,time,126) as time
from table_1", strConnect);
Otherwise, as Rad and Cor said, travel through each row of your table,
create a datetime object for the new column.
Please feel free to let me know if you have anything unclear. I'm glad to
assist you.
Hope this helps,
Sincerely,
Wen Yuan