473,322 Members | 1,241 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,322 software developers and data experts.

How to identify money datatype in ASP.Net

Sri
In VB, to know the field type of a column stored in a recordset the command I
use is

If rsQuery.Fields(k).Type = adCurrency Then

How will I achieve the same in ASP.net. I could not find a currency data
type in asp.net and the type is idenfied as decimal.

I have two fields defined in Sql-Server, one is money and other is decimal.
In asp.net both are identified as decimal.

My requirement is, If the type is money I am adding a $ symbol as prefix and
if it is a decimal I just leave as it is. How to achieve this in asp.net

Nov 22 '05 #1
3 3320
Sri,

You can use the overloaded version of ToString in combination with this

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor
Nov 22 '05 #2
Sri
Thanks for your reply, However my doubt still exists.

I have pasted the sample code here. In thse lines of code, When I convert
the datatype to string, the currency data type gets converted to decimal, How
will I identify the currency datatype
If ds.Tables(0).Columns(k).DataType.ToString =
"System.DateTime" Then
sVal = Format(ds.Tables(0).Rows(j).Item(k),
"mm/dd/yy")
objExcel.Cells(RowCounter, ColCounter) = sVal
'* Be default the money datatype and numeric data type both are identified
as decimal
ElseIf ds.Tables(0).Columns(k).DataType.ToString =
"System.Decimal" Then
sVal = ds.Tables(0).Rows(j).Item(k)
objExcel.Cells(RowCounter, ColCounter) = sVal
objExcel.Range(objExcel.Cells(RowCounter,
ColCounter), objExcel.Cells(RowCounter, ColCounter)).Select()
'** I want to execute the below code only if the datatype is money and not
for decimal. How will I
'** incorporate the same.
objExcel.Selection.NumberFormat = "$#,##0.00"

"Cor Ligthert" wrote:
Sri,

You can use the overloaded version of ToString in combination with this

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor

Nov 22 '05 #3
Sri,

I don't know the datatype money in Net. (That does not say that it does not
exist).

Not either as dbtype
http://msdn.microsoft.com/library/de...classtopic.asp

Or as system.type
http://msdn.microsoft.com/library/de...atypetopic.asp

That makes it in my opinion difficult to use that money type.

(Or is should be somewhere else)

Cor
Nov 22 '05 #4

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

Similar topics

1
by: Chumley the Walrus | last post by:
I'm trying to insert a value into sql dbase, the value "amount" is a money datatype (currency). Below is the parameter for the "amount" value: cmd.Parameters.Add(New SQLParameter("@amount",...
11
by: ZRexRider | last post by:
This may be an easy question but I've been reading for about a half hour and experimenting without results. I simply want the results of my query to display a specific field that is typed...
3
by: Robby Russell | last post by:
Should be a simple question. When selecting a field that is of type money, how can I remove the $ when selected? example: $10.00 would return as 10.00 -Robby
3
by: Ghost | last post by:
Hello. I have some problem to read Money Type Field from my database. I do so: I'm using SqlDataReader object to select some records and I have "float" type variable to store result. I write: ...
4
by: Jerry | last post by:
Is it possible to turn off the "$" and "," that appear in "money" formatted columns so I can dump the table in a numeric format? The man page hints that lc_monetary controls the formatting but I...
5
by: Ronald S. Cook | last post by:
For money values, C# seems to have just DOUBLE as a type. SQL Server 2005 has data types DECIMAL, FLOAT, MONEY, and NUMERIC that seem to all be able to hold a money time. So, given I'll be...
4
by: Ronald S. Cook | last post by:
We're designing the data model for a project. The app will be in .NET, the database will be in SQL Server 2005. I'm a little confused on type conversion between the two and which I should...
2
by: Randy Smith | last post by:
Hi, Does anyone have any good techniques on how to convert an SQL Server 2005 "money" datatype into the ASP.Net "double" datatype? OR, should we be using "decimal" at both ends? TIA, Randy...
3
by: Stephan Diehl | last post by:
Hi lazyweb, I'm wondering, if there is a usable money data type for python available. A quick search in pypi and google didn't convey anything, even though the decimal data type seemed to be...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.