Problem When Multiplying Integers
I need to multiply a price by a quantity. I'm using the following:
intTotal = (int(strPrice) * int(strQuantity))
strPrice contains the value 20.80 and strQuantity contains the value 10
It gives me a total of $200 when it should be $208. Why does it discard the .80 cents in the multiplication? What can I do to fix it?
View Replies
how can I multiply a number with 1.0x.
View Replies
View Related
can any on tell me the code for adding 2 or more items up and the code for multiplying from a user input box and a set number?
View Replies
View Related
I have 3 fields in a table that need to have math functions. Field 1 x field 2 = field 3, then total by customer code and display on a page. How can this be done?
View Replies
View Related
i thought all variables in asp/vbscript were variant? so then why cant i multiply?
im taking 2 fields from a database and trying to multiply them. first i tried:
<%= oRs("FIELD1") * oRs("FIELD2") %>
and got "type mismatch". so i tried:
<%
intQuantity = oRs("FIELD1")
fltPrice = oRs("FIELD2")
Response.Write(intQuantity * fltPrice)
%>
and i still get type mismatch!!
i tried: Val(oRs("FIELD"))
i tried: oRs("FIELD").Value
and STILL i get type mismatch! whats going on??
View Replies
View Related
To put a string on integers togther.
Not like strNumbers = "1,2,3,4"
But like:
strNumbers = 1, 2, 3
so that it can be actually treated like intergers instead of just a string.
View Replies
View Related
i need to use bigger numbers that integer allows in asp. what should i use? i still need the whole number quality of the integer, but when i use anything larger than about ,100,000,000 i get the error Overflow: '[number: xxxxxxxxxxx]'
with the x's being the number i used. anyway around this?
View Replies
View Related
I have two arrays that contain integers and I would like to add them, say array1(0)=1 and array2(0)=1. If I just do something like array1(0) = array1(0) + array2(0) I end up getting 11. How can I make it add the appropriate integers?
View Replies
View Related
I have an array, PositionArray(), which contains a variable number of integers. I need to sort these array elements numerically. Seems I've done this before in VB, but I can't seem to get my mind around it now. Does anyone have a simple bubble-sort code, or is there an ASP way to do this?
My ultimate goal is to take a chunk of text, and highlight (bold, color, whatever) words that are contained in a string array. My thought is to find the position of each word with the InStr() function, then find out which position occurs 1st, which position occurs 2nd, etc., then build a string from the beginning of the text chunk to the position where the first word begins, add a bold tag, add the word, add a </B> tag, and continue until the end of the chunk.
View Replies
View Related
How can I allow entering multiple integers in a field? examples: 11, 13, 15 or 11-16 or 11-16 step 2?
View Replies
View Related
I'm trying to make an array of strings to compare to. Each string will be made up of 3 different 4 digit codes with spaces in between each code (ie "1001 2003 3001").
I'm currently using this code to do this but when I write the string out to the screen I only get the <br>. Code:
View Replies
View Related
I am getting the error below when I am trying to compare two integers.
strbid = rstB("BID")
bid = rscon("BID")
I am getting the values of strbid and bid from two seperate queries.
if (strbid <> bid) then
Microsoft VBScript runtime error '800a000d'
Type mismatch
I know both the fields are of same data type in the database. I am using SQL Server.
Am I doing anything wrong while comparing?
View Replies
View Related
I have developed this script that is meant to take in a value from a database record add one to it and post the new number in the record. It works ok but it always seems to read all database records as 0 never as thier true number (i have tried it set to 1,2,3 etc)
Code:
View Replies
View Related
In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.
Ex.
Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works
Code:
View Replies
View Related