0

Hi all...
So, I am needing to sum all billable hours within a table... the problem is that it is returning rouded decimals instead... like .5 always comes back as 1 ...

Here is my procedure:

Public Shared Function GetBillableTimeForTicket(ByVal SupportTicketID As Integer) As Decimal
        Dim conn As New SqlConnection(GetConnectionString("ClientPortal.My.MySettings.conString"))
        Dim sP As String = "GetBillableTimeForTicket"
        Dim cmd As New SqlCommand()
        cmd.Parameters.Clear()
        cmd.CommandText = sP
        cmd.CommandType = CommandType.StoredProcedure
        cmd.Parameters.AddWithValue("@SupportTicketID", SupportTicketID)
        Dim parameter1 As New SqlParameter("@TotalBillableTime", SqlDbType.Decimal)
        parameter1.Direction = ParameterDirection.Output
        cmd.Parameters.Add(parameter1)
        cmd.Connection = conn
        Try
            HandleConnection(conn)
            cmd.ExecuteNonQuery()
            Try
                Dim totalBillableTime As Decimal = Decimal.Parse(cmd.Parameters("@TotalBillableTime").Value.ToString())
                Return totalBillableTime
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            HandleConnection(conn)
        End Try
    End Function

And here is my StoredProcedure... I have tried so many variations of this SUM... Here is my latest...

ALTER PROCEDURE dbo.GetBillableTimeForTicket
	(
	@SupportTicketID int,
	@TotalBillableTime decimal (18,2) output
	)
As
  Set NoCount On;
  
  SELECT @TotalBillableTime = ROUND(SUM(SupportTicketResponseBillableTime),2) FROM SupportTicketResponses WHERE SupportTicketID = @SupportTicketID;

Any help would be greatly appreciated, thank you in advance... Oh BTW... I'm using SQL 2008 with .NET 3.5

2
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by webwiredit
0

Marked as solved why? If you have solution why didn't you posted?

Typically I do put the solved code for show for others that may have the same problem... It's just that I was trying out daniweb for the first time and wasn't getting a response within a reasonable amount of time, so I went back to the old tried and true forums of asp.net where I got a response right away... I didn't think it would be fair to the person that gave me the answer to share it on a different forum...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.