Hi there,
I have an ASP/SQL 7 application that rips data from SQL Views onto an ASP
page.
I have a money column in a SQL table that contains money income values.
When data is input to this field it needs to be displayed as money (to 2
decimal places - 10.00 or 7.60)
However, this only seems to be occurring when the user puts in the extra 0,
and if 7.6 is entered, it is still displayed as 7.6
I need all data to be displayed as money values (and it is selected as money
in SQL), so is there any way (either in the table design, View design, or
display on the ASP page) to get the data to 2 decimal places, no matter
what?
Thanks for you help, in advance
--
G www.bradflack.com
Please remove ANTI and SPAM from my
email address before sending me an email. 10 5669
Guy Hocking wrote: Hi there,
I have an ASP/SQL 7 application that rips data from SQL Views onto an ASP page. I have a money column in a SQL table that contains money income values.
When data is input to this field it needs to be displayed as money (to 2 decimal places - 10.00 or 7.60) However, this only seems to be occurring when the user puts in the extra 0, and if 7.6 is entered, it is still displayed as 7.6
I need all data to be displayed as money values (and it is selected as money in SQL), so is there any way (either in the table design, View design, or display on the ASP page) to get the data to 2 decimal places, no matter what?
Thanks for you help, in advance
Use one of these vbscript functions:
FormatCurrency
FormatNumber
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Hi,
Thanks for the response -
Any examples of the functions in my scenario?
Cheers
--
G www.bradflack.com
Please remove ANTI and SPAM from my
email address before sending me an email.
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:O9******** *****@tk2msftng p13.phx.gbl... Guy Hocking wrote: Hi there,
I have an ASP/SQL 7 application that rips data from SQL Views onto an ASP page. I have a money column in a SQL table that contains money income values.
When data is input to this field it needs to be displayed as money (to 2 decimal places - 10.00 or 7.60) However, this only seems to be occurring when the user puts in the extra 0, and if 7.6 is entered, it is still displayed as 7.6
I need all data to be displayed as money values (and it is selected as money in SQL), so is there any way (either in the table design, View design, or display on the ASP page) to get the data to 2 decimal places, no matter what?
Thanks for you help, in advance
Use one of these vbscript functions: FormatCurrency FormatNumber
HTH, Bob Barrows
-- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Guy Hocking wrote: Hi,
Thanks for the response -
Any examples of the functions in my scenario?
Given that you have not provided any details about your scenario (where are
you having a problem? Connecting to the database? Retrieving data in a
recordset? Reading the data from the fields in the recordset?), I can't
offer any examples beyond what is shown in the online documentation. Perhaps
that is what you need ... ? Here is a link: http://tinyurl.com/7rk6
Just look up the functions in there once you have downloaded and installed
it. A Google search or a search of www.aspfaq.com could also provide you
with some examples of their use.
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Hi there,
Apologies for that.....
I have downloaded the script docs, and it is very useful, ta.....
But i was wondering how i would incorporate this into my SELECT statement?
See entire code below -
*******
<%
Dim strConnect, DataConnection
Set DataConnection = Server.CreateOb ject("ADODB.Con nection")
strConnect = "DRIVER={SQ L
Server};SERVER= server;UID=user ;PWD=password;D ATABASE=databas e"
DataConnection. Open strConnect
%>
<%
Dim RS
Set RS = DataConnection. Execute("SELECT col2, currencycol FROM view
WHERE col1='" & Session("listbo x") & "'")
do until RS.EOF
<a href= "page.asp?col1= <% =RS("col2")%>"> <% =RS("col2")%></a>
<% =RS("currencyco l")%>
<% RS.MoveNext
Loop %>
*******
How/where can i format the "currencyco l" ???
Thanks again
--
G www.bradflack.com
Please remove ANTI and SPAM from my
email address before sending me an email.
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:#$******** *****@TK2MSFTNG P10.phx.gbl... Guy Hocking wrote: Hi,
Thanks for the response -
Any examples of the functions in my scenario? Given that you have not provided any details about your scenario (where
are you having a problem? Connecting to the database? Retrieving data in a recordset? Reading the data from the fields in the recordset?), I can't offer any examples beyond what is shown in the online documentation.
Perhaps that is what you need ... ? Here is a link:
http://tinyurl.com/7rk6
Just look up the functions in there once you have downloaded and installed it. A Google search or a search of www.aspfaq.com could also provide you with some examples of their use.
Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Guy Hocking wrote: Hi there,
Apologies for that.....
I have downloaded the script docs, and it is very useful, ta..... But i was wondering how i would incorporate this into my SELECT statement?
Why do you need to put it in your Select statement? Just use the appropriate
function when writing the results to your page. Like this:
<% =FormatCurrency (RS("currencyco l"),2)%>
If you really want to do it in your query, look up the CONVERT function in
SQL BOL.
Here is an example for you to run in QA:
select convert(varchar (20),cast(45.12 13 as money))
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Wicked, that works great, 1 thing -
Its coming up in dollars $
How can i get it to do it in pounds £
Cheers
--
G www.bradflack.com
Please remove ANTI and SPAM from my
email address before sending me an email.
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:uM******** ******@TK2MSFTN GP10.phx.gbl... Guy Hocking wrote: Hi there,
Apologies for that.....
I have downloaded the script docs, and it is very useful, ta..... But i was wondering how i would incorporate this into my SELECT statement? Why do you need to put it in your Select statement? Just use the
appropriate function when writing the results to your page. Like this:
<% =FormatCurrency (RS("currencyco l"),2)%>
If you really want to do it in your query, look up the CONVERT function in SQL BOL.
Here is an example for you to run in QA:
select convert(varchar (20),cast(45.12 13 as money))
Bob Barrows -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
Guy Hocking wrote: Wicked, that works great, 1 thing -
Its coming up in dollars $ How can i get it to do it in pounds £
It depends on which one you did. I suspect you're talking about
FormatCurrency rather than the T-SQL CONVERT, so add this line of code to
your page:
session.LCID=20 57
The problem is that the Regional Settings for the IUSR account are the
default (US) settings. You can override that with the LCID property.
Bob Barrows
PS. If you were talking about the CONVERT alternative, simply prepend a
pound symbol:
select char(163) + convert(varchar (20),cast(45.12 13 as money))
or
select '£' + convert(varchar (20),cast(45.12 13 as money))
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows wrote: Guy Hocking wrote: Wicked, that works great, 1 thing -
Its coming up in dollars $ How can i get it to do it in pounds £ It depends on which one you did. I suspect you're talking about FormatCurrency rather than the T-SQL CONVERT, so add this line of code to your page:
session.LCID=20 57
Sorry, I should have said
Response.LCID =2057
The Session setting will affect all pages accessed during the session,
unless overridden with the Response setting. If you use the Session setting,
it should be done in global.asa.
Bob Barrows
PS. I just realized you included the sql server setup group in your
crosspost. That did not seem to be an appropriate group so I've just removed
it from this reply. If any sql server group was relevant, it would have been
..programming.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Exellent, the session LCID worked a treat,
Thanks for the wonderful service you ppl provide
--
G www.bradflack.com
Please remove ANTI and SPAM from my
email address before sending me an email.
"Bob Barrows" <re******@NOyah oo.SPAMcom> wrote in message
news:eC******** ******@TK2MSFTN GP09.phx.gbl... Guy Hocking wrote: Wicked, that works great, 1 thing -
Its coming up in dollars $ How can i get it to do it in pounds £ It depends on which one you did. I suspect you're talking about FormatCurrency rather than the T-SQL CONVERT, so add this line of code to your page:
session.LCID=20 57
The problem is that the Regional Settings for the IUSR account are the default (US) settings. You can override that with the LCID property.
Bob Barrows PS. If you were talking about the CONVERT alternative, simply prepend a pound symbol:
select char(163) + convert(varchar (20),cast(45.12 13 as money)) or select '£' + convert(varchar (20),cast(45.12 13 as money)) -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM"
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rahul Chatterjee |
last post by:
Hello All
I have an asp page in which I am performing the following
1. Querying a database view
2. Returning rows in to a recordset.
3. Looping thru the recordset and printing the data
4. Before displaying the data I am assigning the values from the recordset
into variables
5. There are 2 entry points to this page both of which would run similar
|
by: Michael Hill |
last post by:
Hi, folks.
I am writing a Javascript program that accepts (x, y) data pairs from
a text box and then analyzes that data in various ways. This is my
first time using text area boxes; in the past, I have used individual
entry fields for each variable. I would now like to use text area
boxes to simplify the data entry (this way, data can be produced by
another program--FORTRAN, "C", etc.--but analyzed online, so long as
it is first...
|
by: pmud |
last post by:
Hi,
I have an image which resides on a different server...on data server. I am
developing on Development server. When I use the image URLin my ASP.Net web
page as xxx.xxx.x.xx\\SHARE\GRAPHICS\image.jpg , that image shows up in the
development server but when I use my local machine for vewing that image , it
doesnt show up...Why is that?
--
pmud
|
by: .Net Sports |
last post by:
the below itemdatabound function works , displays all the grand totals
in the footer control of the datagrid:
private void dglvboard_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
DataRowView rowData;
decimal price;
decimal priceWk;
decimal newssum;
|
by: Sam |
last post by:
I am trying to use a Simple form with 3 fields from SQL NorthWind
Database (Order Details Table with 3 Fields. - OrderId, ProductId and
Unit Price). The Field Unit Price has a data type of 'Money Type'.
All I want is to able to edit/view/insert 'UnitPrice' field with 2
decimal points instead of 4 decimal points.
If I use: Bind("UnitPrice", "{0:c}") in Edit Template, I got: "Input
string was not in a correct format...". Although this...
| |
by: Sam |
last post by:
Folks..
I am trying to use a Simple form with 3 fields from SQL NorthWind
Database (Order Details Table with 3 Fields. - OrderId, ProductId and
Unit Price). The Field Unit Price has a data type of 'Money Type'.
All I want is to able to edit/view/insert 'UnitPrice' field with 2
decimal points instead of 4 decimal points.
|
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
choose.
I found this good comparison chart:
http://msdn2.microsoft.com/en-us/library/ms131092.aspx
But for monetary amounts, it looks like decimal is how .NET is going to
|
by: D.M. Procida |
last post by:
I'm trying to find a guide for the formatting and presentation of
numbers in web pages, which will answer questions along the lines of
what if anything to use as separators in large figures, how to use
abbreviations for things like millions of dollars, and so on.
Thanks,
Daniele
|
by: drwigginton |
last post by:
I have created several bar charts in MS Access using query results to provide the data for the chart. I added data tables to the charts to show the actual values. My problem is that one of the fields in the data table continues to display a number with several decimal places showing (i.e., 7.120000054). The query field that provides the number displays the number with 1 decimal place (i.e., 7.1), which is what I'm trying to get the data table to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
|
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...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |