D
D. Shane Fowlkes
Hey guys. I have a Repeater and a Template. One of the dataitems calls a
helper function. The dataitem sends the record ID to the function and the
function runs a complex query and returns a calculation which is a dollar
amount. The ID is a "construction project" and the helper function goes and
determines how much money has already been spent against the project by
querying expenditure tables.
The function works fine but how can I format the output to be currency? I
also noticed that even though my function returns data of a Decimal type, it
seems to come out as a Integer. No "cents" are written to the page.
Thanks!
(In VB)
<code>
Function CalculateExpended(intBudgetID As Integer) As Decimal
Dim objConnection As SqlConnection
Dim cmdSelectData As SqlCommand
Dim strConnectString As String
Dim strSQL As String
Dim decExpendedAmt As Decimal
strConnectString =
System.Configuration.ConfigurationSettings.AppSettings("SqlConnection")
strSQL = "SELECT Stuff....."
objConnection = New SqlConnection(strConnectString)
cmdSelectData = New SqlCommand(strSQL, objConnection)
objConnection.Open()
decExpendedAmt = cmdSelectData.ExecuteScalar()
objConnection.Close()
Return decExpendedAmt
End Function
In Template....
Expended: <%# (CalculateExpended(Container.DataItem("ID"))) %>
</code>
helper function. The dataitem sends the record ID to the function and the
function runs a complex query and returns a calculation which is a dollar
amount. The ID is a "construction project" and the helper function goes and
determines how much money has already been spent against the project by
querying expenditure tables.
The function works fine but how can I format the output to be currency? I
also noticed that even though my function returns data of a Decimal type, it
seems to come out as a Integer. No "cents" are written to the page.
Thanks!
(In VB)
<code>
Function CalculateExpended(intBudgetID As Integer) As Decimal
Dim objConnection As SqlConnection
Dim cmdSelectData As SqlCommand
Dim strConnectString As String
Dim strSQL As String
Dim decExpendedAmt As Decimal
strConnectString =
System.Configuration.ConfigurationSettings.AppSettings("SqlConnection")
strSQL = "SELECT Stuff....."
objConnection = New SqlConnection(strConnectString)
cmdSelectData = New SqlCommand(strSQL, objConnection)
objConnection.Open()
decExpendedAmt = cmdSelectData.ExecuteScalar()
objConnection.Close()
Return decExpendedAmt
End Function
In Template....
Expended: <%# (CalculateExpended(Container.DataItem("ID"))) %>
</code>