473,386 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DataColumn Format

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
Nov 22 '05 #1
0 904

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: JMorrell | last post by:
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...
3
by: J | last post by:
Is there anyway to format a calculated datacolumn? I would like the following column to display as money (formatted as $#,##0.00). Or how about simply displaying the column formatted as a number...
1
by: Chris | last post by:
I'm having trouble Serializing a System.Data.DataColumn object. When I try to serialize it, I get the following: System.NotSupportedException: Cannot serialize member...
4
by: bordsby | last post by:
Situation: I am using an OleDbDataAdapter to fill a DataSet's DataTable with data from an Access database. The DataSet's DataTable is bound to a DataGrid. After the OleDbDataAdapter.Fill method...
1
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I...
11
by: Matt F | last post by:
I'm trying to do something that seems like it should be pretty simple, but haven't found a solution. I am trying to add a datacolumn to a datatable that adds or subtracts a number of days based on...
0
by: SWIL | last post by:
Hi, I made my own datacolumn Class which inherits from Data.DataColumn. To this class I have added 2 properties. To add datacolumn created through my new class I have to call.. ...
0
by: Rainer Queck | last post by:
Hello NG, using the dataset designer, what is the right format to assigne a defaultvalue to DataColumn in the property editor? Thanks for help. Regards Rainer Queck
3
by: DaveP | last post by:
im Trying to set a Datacolumn type for a new table boolean is not working, What is the correct waty //column.DataType = System.Type.GetType"System.Data.SqlTypes.SqlBoolean"); column.DataType...
0
by: SMH | last post by:
Hi All, I am currently learning .Net 2, studying for 70-528. I've hit a bit of a brick wall with DataColumn.Expression. As I understand it, this can be used to (For example) concatenate two...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.