473,782 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Currency,Decima l,Access and Confusion

Hi Everyone,

I'm trying to extract my pricing from my Access.mdb. Developing WinForm C#.
I've read previous posts on the subject, but I'm still confused.

In Access my "Price" is of "Currency" type. I extract my items
"myDataItem.MyP rice(Convert.To Decimal(myDataR eader["Price"]));

Now my problem like so many others is that if my dollar value is $10.00, and
when I try to extract my data, it converts some how to just "10". How do I
loose the ".00" decimal and the cents? If I have $10.99 value, all is
displayed correctly. Why does this do that, and what do I need to do to
correct this problem. As stated in past posts do I just need to take the
"10" and build a string.Format to rebuild/add the .00 decimal and cents?

Any and all help is appreciated,

MikeY
Apr 13 '06
11 2969
On Thu, 13 Apr 2006 11:22:11 -0400, "MikeY" <mi*******@yaho .com> wrote:
Hi Everyone,

I'm trying to extract my pricing from my Access.mdb. Developing WinForm C#.
I've read previous posts on the subject, but I'm still confused.

In Access my "Price" is of "Currency" type. I extract my items
"myDataItem.My Price(Convert.T oDecimal(myData Reader["Price"]));

Now my problem like so many others is that if my dollar value is $10.00, and
when I try to extract my data, it converts some how to just "10". How do I
loose the ".00" decimal and the cents? If I have $10.99 value, all is
displayed correctly. Why does this do that, and what do I need to do to
correct this problem. As stated in past posts do I just need to take the
"10" and build a string.Format to rebuild/add the .00 decimal and cents?

Any and all help is appreciated,

MikeY


moneyString = string.Format(" ${0:0.00}", yourDecdimalNum ber);

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
Apr 14 '06 #11
Hi Otis, Thanks for the response I'll give it a go and see how your syntax
works out.

Thanks again

MikeY

"Otis Mukinfus" <ph***@emailadd ress.com> wrote in message
news:2g******** *************** *********@4ax.c om...
On Thu, 13 Apr 2006 11:22:11 -0400, "MikeY" <mi*******@yaho .com> wrote:
Hi Everyone,

I'm trying to extract my pricing from my Access.mdb. Developing WinForm
C#.
I've read previous posts on the subject, but I'm still confused.

In Access my "Price" is of "Currency" type. I extract my items
"myDataItem.M yPrice(Convert. ToDecimal(myDat aReader["Price"]));

Now my problem like so many others is that if my dollar value is $10.00,
and
when I try to extract my data, it converts some how to just "10". How do I
loose the ".00" decimal and the cents? If I have $10.99 value, all is
displayed correctly. Why does this do that, and what do I need to do to
correct this problem. As stated in past posts do I just need to take the
"10" and build a string.Format to rebuild/add the .00 decimal and cents?

Any and all help is appreciated,

MikeY


moneyString = string.Format(" ${0:0.00}", yourDecdimalNum ber);

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com

Apr 14 '06 #12

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

Similar topics

17
6153
by: John Bentley | last post by:
John Bentley: INTRO The phrase "decimal number" within a programming context is ambiguous. It could refer to the decimal datatype or the related but separate concept of a generic decimal number. "Decimal Number" sometimes serves to distinguish Base 10 numbers, eg "15", from Base 2 numbers, Eg "1111". At other times "Decimal Number" serves to differentiate a number from an integer. For the rest of this post I shall only use either...
4
22600
by: Gerry Abbott | last post by:
Hi All. How can i put a zero decimal for my currency into my format statement, == & ", for " & & " days. Cost " & Format(,"Currency") which is the data source for a textbox on a report
4
9425
by: digitalavatar | last post by:
I am having a problem with my Access 2000 front end to a SQL 7 or 2000 database. I create a table in SQL with a field named, say, amt, data type MONEY. When I link the table in Access using ODBC, the field is defined as CURRENCY, as expected. Now, if I use SQL to populate the field with a 3- or 4-decimal amount like 1.234, it appears in the Access table as 1.23 only. If I expand the decimals to 3 places it will be 1.230; if the...
3
2041
by: Dave Stone | last post by:
This question appeared years ago in the context of Acc2K and SQL Server 7, but no replies were posted. HOWEVER!! It still seems to be a problem with Acc XP and SQL Server 2000. Surely someone has a fix 6 years down the line... I used the Upsizing Wizard to build a SQL database from an Access back-end and link it to the Access f/e. All the data appear to have gone across OK as viewed from Enterprise Manager, but from the front-end all...
2
2869
by: David Nunn | last post by:
Need to preface that I am not much of an Access type. Doing I have several tables that have currency fields, which I run queries against to compare the figures in both. The data is imported from Excel spreadsheets supplied by different parties, over which I have no control. My problem is that whilst several parties supply the spreadsheets with the currency fields containing two figures to the right of the decimal place (ie 123.51,...
3
24403
by: Mark | last post by:
How do you parse a currency string to a decimal? I'd like to avoid having to parse the number out, removing the $ manually. That sounds like a hack. There are times that this string will be currency and others when it will be a text integer or decimal. //This bombs because of the string having an improper format. Decimal.Parse("$9,200.00") Thanks in advance! Mark
11
2957
by: Adrian | last post by:
Hi I want to use the following declarations but vb dotnet keeps complaining that currency can't be used because it private ? I have tried it in a module and in the declaration pare same error! Private Declare Function QueryPerformanceFrequency Lib "kernel32" (ByVal
2
3653
by: crazytegger | last post by:
Hi all, Im having trouble with currency formatting and the amount of decimals displayed. Most of my stored values are pretty standard ($10.50). Some item have a 4 decimal place cost though ($.0025). I have the table formatted to store 4 decimal places but when using the currency format it drops the last two places of the value. Is there a way around this or do i have to use general number format for the table? I also dont want the field to...
14
4361
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my unformatted data values (as decimals) just fine, so I know there's not a problem with the data retrieval, just the formatting. I have read that this would work: lblPrice.Text = prodRow.ToString("C");
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10308
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...
1
10076
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
8964
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...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5375
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
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
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
3633
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.