SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
Thread: problem with mysql decimal field
-
May 20, 2005, 15:41 #1
- Join Date
- Aug 2002
- Location
- center pixel
- Posts
- 68
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
problem with mysql decimal field
First of all, it is late Friday afternoon which is part of the problem
I am trying to display a datafield that is a decimal number in mySQL thru ASP. The numbers after the decimal point do not display (i.e. 5.75 appears as 5.00). The second problem I am encountering is that if there is more than one record, assigning a variable to add the records for a total.
I have tried some ASP conversions (CInt and FormatNumber for example) with no luck but I admit I am not very knowledgeable in doing that.
Here is the sql statement for getting the info:
Code:Set RSOrderItems = db.Execute("Select OrderID, StockID, ProductName, ProductWeight, SalePrice From a_table Where CustomerID = " & thisID &"")
Here is ASP for displaying and adding the weight. The Price data is displaying and adding together with no problem.
ASP CODE:
Code:<% 'OrderWeight = FormatNumber(OrderWeight,2) Do Until RSOrderItems.EOF %> <TR> <TD WIDTH=500><%= RSOrderItems("ProductName") %> <TD WIDTH=100> <% Response.Write FormatCurrency(RSOrderItems("SalePrice"),2) %> <TD WIDTH=100> <% Response.Write FormatNumber(RSOrderItems("ProductWeight"),2) %> </TR> <% OrderTotal = OrderTotal + RSOrderItems("SalePrice") ' OrderWeight = OrderWeight + RSOrderItems("ProductWeight") RSOrderItems.MoveNext Loop %>
Thanks,
JamesEverything is going as planned...now where is that ball of twine.
Bookmarks