none
Calculated column of time TimeSpan RRS feed

  • Question

  • Hello. I have a table with two string columns containg date time. Since the value can be empty string as well i was forced to use calculated columns to keep these values as DateTime.
    Now i want to add a column calculating the difference between these times. For my surprise i get EvalulationException at run time saying it can not evaluate subtract operation for DateTime type.
    What I (or .NET Framework) do wrong?
    Tuesday, October 2, 2007 1:53 PM

All replies

  • Hi,

     

    Can you please post your code so that we can easily understand your scenario. Also the database structure would help.

     

     

     

     

     

    cheers,

     

    Paul June A. Domag

    Tuesday, October 2, 2007 3:26 PM
  • Hello. I have receive an XML with a structure like the following:

    <data>
     ...
     <shows>
      <show id="123" start_time="02/10/2007 10:02:15" stop_time=02/10/2007 15:02:15" />
     </shows>
    </data>


    I have a dataset with a table "show" which has columns matching attributes of the xml. In the table i've added two calculated fields start_datetime and stop_datetime respectivly. Their expression is the same with relation to the original field:
    IIF(start_time<>'',Convert(start_time,System.DateTime),NULL)

    It is done this way since the case when there is no start/stop time handled by the empty string in the attribute and it can not be converted to the DateTime.

    Now i'd like to have the 3rd calculation field which checks first two calculated fields to be not null values and then calculate the delta between them. I get exception each time I load XML data into the table.

    If  there is more info needed, please explain which one and i will publish it.
    Wednesday, October 10, 2007 1:36 PM