Build error

Cartillo
Cartillo used Ask the Experts™
on
Hi Experts,

I would like to request Experts help. The attached script shows error as "Build error". Hope Experts could help me to fix this error.
Imports MyCompany.Data
Imports System
Imports System.Collections.Generic
Imports System.Data
Imports System.Linq
Imports System.Text.RegularExpressions
Imports System.Web

Namespace Rules
    
    Partial Public Class DataBusinessRules
        Inherits MyCompany.Rules.SharedBusinessRules
        
        <ControllerAction("Data", "Calculate", "Total_Duration")>  _
        Public Sub CalculateData(ByVal data_ID As Nullable(Of Integer), ByVal [date] As Nullable(Of DateTime), ByVal task As String, ByVal timeIN As Nullable(Of System.TimeSpan), ByVal timeOUT As Nullable(Of System.TimeSpan), ByVal total_Duration As Nullable(Of System.TimeSpan))
            UpdateFieldValue("Total_Duration", (datediff(HOUR,[TimeIN],[TimeOUT])))
        End Sub
    End Class
End Namespace

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Todd GerbertIT Consultant
Top Expert 2010

Commented:
What is the error and on what line?

Author

Commented:
Hi,

Here's error message that I got:

Error      1      Argument not specified for parameter 'TimeValue' of 'Public Function Hour(TimeValue As Date) As Integer' at line 16.
IT Consultant
Top Expert 2010
Commented:
You currently have:
UpdateFieldValue("Total_Duration", (datediff(HOUR,[TimeIN],[TimeOUT])))

That's going to call the UpdateFieldValue method with two parameters; the first being the string "Total_Duration" and the second being whatever the return value of the datediff function with the given parameters - but datediff is not a valid VB.Net function.

You probably want to call UpdateFieldValue with two strings:
UpdateFieldValue("Total_Duration", "(datediff(HOUR,[TimeIN],[TimeOUT]))")

Author

Commented:
Hi tgerbert,

Thanks for the fix. However when I add the time value at TimeIN and TimeOUT column, the Total_Duration columns was not returned with total duration (sum) as suppose to. How to get the value automatically update the Total_Duration column?

Author

Commented:
Hi,

Thanks for the help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial