I need to substract break and lunch times based on the following

Sql statement

CREATE VIEW dbo.vwu_ExcelReport

AS

select, logout, login, AMBreakOut, AMBreakIn, LunchOut, LunchIn, PMBreakOut, PMBreakIn

, CASE

WHEN ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) >= 0 AND ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) <= 19

THEN '00:00'

WHEN ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) >= 20 AND ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) <= 34

THEN '00:15'

WHEN ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) >= 35 AND ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) <= 49

THEN '00:30'

WHEN ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) > = 50 AND ISNULL(DATEDIFF(Minute, AMBreakOut, AMBreakIn),0) <= 64

THEN '00:45'

ELSE ' 01:00'

END AS AMBreak <=

, CASE

WHEN ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) >= 0 AND ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) <= 66

THEN '00:0'

WHEN ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) >= 67 AND ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) <= 81

THEN '00:15'

WHEN ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) >= 82 AND ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) <= 96

THEN '00:30'

WHEN ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) >= 97 AND ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) <= 111

THEN '00:45'

WHEN ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) >= 112 AND ISNULL(DATEDIFF(Minute, LunchOut, LunchIn),0) <= 126

THEN '01:00'

ELSE '01:15'

END AS LunchBreak <=

, CASE

WHEN ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) >= 0 AND ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) <= 19

THEN '00:00'

WHEN ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) >= 20 AND ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) <= 34

THEN '00:15'

WHEN ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) >= 35 AND ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) <= 49

THEN '00:30'

WHEN ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) >= 50 AND ISNULL(DATEDIFF(Minute, PMBreakOut, PMBreakIn),0) <= 64

THEN '00:45'

ELSE '01:00'

END AS PMBreak <=

form timetable

When I use AMBreak, LunchBreak, PMBreak in my code behind file (

VB) the variables are all string and do not add nor substract. TimeWorked shows up as a continous string of:

1/1/1900 6:28:50 AM00:0000:4500:00 .

Protected Function getTimeWorked(ByVal dataitem As Object) As Object

Dim strTimeLog As String = DataBinder.Eval(dataitem, "TimeLog")

Dim strAMBreak As String = DataBinder.Eval(dataitem, "AMBreak")

Dim strLunchBreak As String = DataBinder.Eval(dataitem, "LunchBreak")

Dim strPMBreak As String = DataBinder.Eval(dataitem, "PMBreak")

Dim TimeWorked As String = strTimeLog + strAMBreak + strLunchBreak + strPMBreak

Return TimeWorked

End Function

when my goal is to subtract the logout from login, minus AMBreak , LunchBreak, PMBreak where applicable.

SQL will not accept the variables using (logout-login) - (AMBreak) - (LunchBreack) - (PMBreak).

When writing the results to the browser the correct values for AMBreak, LunchBreak, PMBreak are written

A solution to this is so very much appreciated!

Gail