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

dr("field").toString returns "400.0000" instead of "400"

I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

For example...

? dr("CostsPerBin")

returns

400D {Decimal}
[Decimal]: 400D
? dr("CostsPerBin").toString


returns
"400.0000"

It used to return "400" before I installed VS.NET2K3

Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

Any ideas?

It works normally on our dev box and production server and also on other developers machines.

I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)

Thanks,

Dan

Nov 17 '05 #1
5 2837
This is a classic asp newsgroup. While you may be lucky enough to find a
dotnet-savvy person here who can answer your question, you can eliminate the
luck factor by posting your question to an appropriate group. I suggest
microsoft.public.dotnet.framework.adonet or microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows
Nov 17 '05 #2
Yep - I replied to the wrong message, somehow. Sorry about that
"Dan C Douglas" <no********@nowhere.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
heh.. i think your looking at another message. I posted to

microsoft.public.dotnet.framework.adonet,

microsoft.public.dotnet.framework.aspnet,

microsoft.public.sqlserver.programming

-Dan

"Bob Barrows" <re*******@yahoo.com> wrote in message news:#4*************@TK2MSFTNGP12.phx.gbl...
This is a classic asp newsgroup. While you may be lucky enough to find a
dotnet-savvy person here who can answer your question, you can eliminate the
luck factor by posting your question to an appropriate group. I suggest
microsoft.public.dotnet.framework.adonet or microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows
Nov 17 '05 #3
Yeah, we had to make some small code changes when switching over to the 1.1 framework as well. Our interface to PayPal broke because it considered more than 2 decimal places to be an invalid format.

-Mark
"Vik" <viktorum@==yahoo.com==> wrote in message news:ek**************@TK2MSFTNGP12.phx.gbl...
I have similar problem. Decimal zeros don't show on my machine (NET Framework 1.0) and show on a server (Framework 1.1). I couldn't find a reason and just use str = Format(tmp, "N").

Vik
"Dan C Douglas" <no********@nowhere.com> wrote in message news:uM**************@tk2msftngp13.phx.gbl...
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

For example...

? dr("CostsPerBin")

returns

400D {Decimal}
[Decimal]: 400D
? dr("CostsPerBin").toString


returns
"400.0000"

It used to return "400" before I installed VS.NET2K3

Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

Any ideas?

It works normally on our dev box and production server and also on other developers machines.

I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)

Thanks,

Dan

Nov 17 '05 #4
For example we are using currency fields for large dollar amounts.

So for a dollar amount the user wants to see: 850,190, and not 850,190.0000

The difference is that the one machine with different results also has framework 1.1 side by side with 1.0 (even though the app should be using 1.0)

Surprisingly cost per bin are at a dollar value, but this issue has affected hundreds of fields that never had that problem before, so it goes belong just this one field.

And yes, in this case, I'd like to drop any trailing 0 decimals (this was done automatically before) w/o making any major modifications to the app. It just seems silly that by installing .NET Framework 1.1 that this would affect my apps running the original Framework 1.0

"Bob Grommes" <bo*@bobgrommes.com> wrote in message news:OX**************@TK2MSFTNGP11.phx.gbl...
I don't know why you'd get different results on one machine vs another, but you can simply tell ToString() exactly what you want and that will remove any ambiguity, now or in the future -- for example:

? dr("CostsPerBin").ToString("F0");

I question, though, why you want to drop the decimal positions. Seems like cost per bin would not often be exactly at a dollar boundary. Or are you saying you just want to drop the decimals if they are all zero? Not sure if there's a standard format string that would produce that effect by itself.

--Bob
"Dan C Douglas" <no********@nowhere.com> wrote in message news:uM**************@tk2msftngp13.phx.gbl...
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

For example...

? dr("CostsPerBin")

returns

400D {Decimal}
[Decimal]: 400D
? dr("CostsPerBin").toString


returns
"400.0000"

It used to return "400" before I installed VS.NET2K3

Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

Any ideas?

It works normally on our dev box and production server and also on other developers machines.

I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)

Thanks,

Dan

Nov 17 '05 #5
The app was mapped to 1.1.

I believe if I map it to 1.0 it should fix the problem.

Still. It's good to know how installing 1.1 may affect our existing apps when we install it on production. The install (according to MS) shouldn't of effected existing apps, but according to asp.net website it does.

I am fixing it now...
"Mark Heimonen" <ma***@adiaim.com> wrote in message news:uM**************@TK2MSFTNGP11.phx.gbl...
Yeah, we had to make some small code changes when switching over to the 1.1 framework as well. Our interface to PayPal broke because it considered more than 2 decimal places to be an invalid format.

-Mark
"Vik" <viktorum@==yahoo.com==> wrote in message news:ek**************@TK2MSFTNGP12.phx.gbl...
I have similar problem. Decimal zeros don't show on my machine (NET Framework 1.0) and show on a server (Framework 1.1). I couldn't find a reason and just use str = Format(tmp, "N").

Vik
"Dan C Douglas" <no********@nowhere.com> wrote in message news:uM**************@tk2msftngp13.phx.gbl...
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to VS.NET 2003 yet and I am still developing it in VS.NET 2002.

When I am putting values from my SQLDataReader into labels and text boxes I am getting results such as 400.0000, or 25.90.

For example...

? dr("CostsPerBin")

returns

400D {Decimal}
[Decimal]: 400D
? dr("CostsPerBin").toString


returns
"400.0000"

It used to return "400" before I installed VS.NET2K3

Obviously it is returning 4 decimals because it is the scale of the data type in SQL. This is a money field, although other fields that are decimal with a scale of 2 return results such as 90.40 when converted to a string.

Any ideas?

It works normally on our dev box and production server and also on other developers machines.

I am the only one in the office who has install VS.NET2K3, but I don't understand how it would change these results.

Is this a feature of .NET Framework 1.1 ? (project is still .NET framework 1.0 as I didn't upgrade it though)

Thanks,

Dan

Nov 17 '05 #6

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

Similar topics

2
by: Mad Scientist Jr | last post by:
I am populating a dropdownlist from SQL. The query returns the correct values (and no NULLs in any fields). The listitem.value is populated with an int ID field, and listitem.text with a varchar...
1
by: TJS | last post by:
This code runs fine on my local machine but fails on the webhost server. Any ideas why ??? Exception Details: System.NullReferenceException: Object reference not set to an instance of an...
1
by: ocn0248 | last post by:
The code bellow must be executed under safari web-browser. I need to know how I can get the major version of the safari web-browser. Thanks in advance vb.net code Partial Class SafariTest...
3
by: Nathan R. | last post by:
Hi, I'm seeing something that seems extremely strange to me. All I'm doing is overriding the toString method in one of my classes, so that instances will display the way I'd like in Combo boxes...
2
by: Anastasios Papadopoulos | last post by:
Hello all, I have statements like the following in my Property Get: Public Property AccountNumber() As String Get Return MyClass.AccountNumber.ToString End Get blah blah End Property
2
by: homepricemaps | last post by:
i run a mapping website at http://www.HomePriceMaps.com which maps real estate prices however i have found that when i do select * where there are 10 records found in the db that for some reason...
9
by: trini | last post by:
hi there, I found this code on your forum for which I am glad because I can use it pretty well IF there's a way to alter it and get a 32-character hashcode instead of 16! Anybody knows what's...
2
by: usfshelly | last post by:
I have an access db with 60+ records in a table, I am trying to display the records on a page. At this point, I am able to connect to the db, but I can only get the first record within the...
1
by: jwendt | last post by:
When using the sprintf function the converted results buffer contains a mixture of the correct converted results and the provided format parameters. Example: temp=123; status=5; ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.