Hi all.
I have a situation where I needed to add a new column to a view coming over
from a SQL Server. The code to add the column is as follows:
' new column for Sick Hours Sum
Dim dcSickEndBal As DataColumn = New DataColumn("Ending Sick Balance")
dcSickEndBal.Expression = "begsickbal + sumsickearned - sumsickused"
DsSAL2.vEmpSickLeaveSums.Columns.Add(dcSickEndBal)
...... then when it's displayed .........
' list Sick Leave information
For Each drDetails In draEmployeeSickDetails
For Each dcDetails In drDetails.Table.Columns
details &= dcDetails.ColumnName & ": "
details &= drDetails(dcDetails).ToString
details &= ControlChars.CrLf
Next
details &= ControlChars.CrLf
Next
Within the SQL view I use round() to keep the output to just 2 decimals.
When it appears on my VB output, the formatting that should be taken care of
with round() doesn't seem to happen.
Is there a way to format the DataColumn so I just see 2 decimal places? I
tried:
details &= drDetails(dcDetails).ToString("N2")
and get the error:
"'Public overrideable function ToString()' has no parameters and its return
type cannot be idexed."
tia,
--
JMorrell
|