473,657 Members | 2,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dr("field").toS tring 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 2857
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.publi c.dotnet.framew ork.adonet or microsoft.publi c.dotnet.framew ork.aspnet.

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

microsoft.publi c.dotnet.framew ork.adonet,

microsoft.publi c.dotnet.framew ork.aspnet,

microsoft.publi c.sqlserver.pro gramming

-Dan

"Bob Barrows" <re*******@yaho o.com> wrote in message news:#4******** *****@TK2MSFTNG P12.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.publi c.dotnet.framew ork.adonet or microsoft.publi c.dotnet.framew ork.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@==yah oo.com==> wrote in message news:ek******** ******@TK2MSFTN GP12.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********@now here.com> wrote in message news:uM******** ******@tk2msftn gp13.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******** ******@TK2MSFTN GP11.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********@now here.com> wrote in message news:uM******** ******@tk2msftn gp13.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.c om> wrote in message news:uM******** ******@TK2MSFTN GP11.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@==yah oo.com==> wrote in message news:ek******** ******@TK2MSFTN GP12.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********@now here.com> wrote in message news:uM******** ******@tk2msftn gp13.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
2201
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 description field. The problem is, for some reason, I cannot access the numeric ID after item #5 in the dropdown box. After item #5, if I try to read the ListItem.value, I get the ListItem.text. If I run the query in Query Analyzer, I can see the...
1
3193
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 object. Source Error: Line 73:
1
2207
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 Inherits System.Web.UI.Page
3
1031
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 and the like. But instead of calling the overridden method of the subclass, it looks like Object.toString is being called instead -- toString returns "MyProjectName.MyClassName". So that's strange and mysterious, but that's not the end of it. ...
2
2882
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
1081
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 only 9 are returned to the user. If there are only 2 records found in the db than only 1 is returned. my php code looks like this and i cannot tell if its the logic of my php code or perhaps my javascript: php code
9
11166
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 wrong here? Thnx ------------------------------------------------------------------------------------------------------------ Working Code: Private Declare Function CryptAcquireContext Lib "advapi32.dll" _ Alias "CryptAcquireContextA" ( _ ...
2
1736
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 recordset. I've tried everything I can think of, so I'm hopeing someone with a fresh mind can review and see what I'm doing wrong. <% Dim conn, rs, DBPath Set conn = Server.CreateObject("ADODB.Connection") conn.Open...
1
1401
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; bytecount=sprintf(buffer, "S,%d,%u,E",temp,status); buffer should contain S,123,5,E but
0
8842
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7352
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2742
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.