I had recently found a function that will write out a currency amount in words. It worked fine until I passed it a variable retreived from the stored procedure.
Well I had to change an "Int()" to "CDbl()" within the function because I got an error: "Variable uses an Automation type not supported in VBScript". I also changed an "(Abs(nAmount)" to an "(Abs(CDbl(nAmount))" because of the same error. Code:
I'm currently working on a form that, upon submit, generates an RTF file. I've run into a little formatting issue. If you're typing in a text box, much like this one, and hit Enter to go down to a new line, nothing happens in the RTF coding. For me to have a text box Enter/Line translate into my RTF file, I need to replace it with /par . So, I know about the Replace() string function, but how can I make this work with a carriage return
I have a string as "123.45" and want to convert it to 123.45 so that I can do some multiplication calculation. How do I do this so that it could work> I am really lost.
if its possible to loop through my entire DB Table and do String Case Conversion. I only want to chnage the case of certain fields. I can get each of the field value and update them easily but I need a way to convert them to the case I want.
The standard LCase and UCase function are ok but I want the formating to be mixed like Title case (in MS Word) or Capitalise (text-transform in HTML/CSS). Basically I've some of the values are in upper case some in lower case I want them all to be Title Case Similar To: Html Css Text-transform Like This Line .
I need to round off a few fields to 1 or 2 decimal places but if the number is negative, it gives -0.0 or -0.00 after rounding off. Eg. -0.001356 after rounding off to two decimal places gives me -0.00...which is meaningless as -0.00 is useless Also, -0.019 should give -0.02.Tried using FormatNumber and Round functions in VBScript but still it gives the same results.
I have a page in witch 4 or so variables are loaded from a database. They are of currency format and then they are add up to get a total. Problem is that say the total is $6.10 the actual return is rounded down to $ 6.1 . How can I get it to show $6.10 , less rounding ??
I've got this script, and its been giving me this result as seen below. 2 questions I would like to ask..
1. How would I modify the below script in order to round the numbers?. (Script further down.)
2.You see the output result where it says 3268.19?, the white space next to it means the 'Parts' record set is blank but did have a weight value, now how would I substitute the word "NA" for the white space being shown? .....
I'm trying to work out how I can round off a number that the user inputs. I need the number to round up to the nearest 50. For example, if the user enters 234, I want it to round up to 250. If the user enters 51, I want it to round up to 100. Has anyone got any suggestions for coding?
If CInt(StrFirst) rounds up the value what rounds down the number i.e just show the whole number with out taking in to account anything after the decimal point?
Right now I round my number to 2 decimal places... and since I am dealing with money values I need to show $100.70...but my calculations show $100.7. Is there a way to fix this? How can I tack on a "0" if it only shows 1 decimal place?
I'm trying to calculate two time fields. And when the result is smaller then 15 min, it has to round it to 15 min. Example:
begin time: 14:00 end time: 14:40 (end time - begin time = 40 minutes) result has to be: 45 minutes
The result wil be shown in a form field. This is the code I'm using (it works fine in my database), perhaps I have to adjust it for asp? But I don't know how. Code:
I'm doing up a stats page for a survey, and this is a small part of one of the results. Below is part of the code to do totals/percents. My question is, how do i make it so myAnswer is written with two decimal places?
Currently, it displays the percent as 4.76190476190476
I have got the total amount of hours flown in the top left hand side of the home page and it is in hours.
Trouble is the decimal places need to be rounded to 2 as sometimes it says sometihg like 3254.63333333333 hours. I'd like it to say something like 3254.63 instead.. Code:
The following code gets me the day of the month which I use in a query to give me all employees' birthdays for this period. But I have a bug: day variable used in the query must give me todays date(19),it gives me 21 (2 more than I want)
I could really do with some guidance. I am currently hosting my website on a Windows Server, and use ASP pages for accessing MS Access database data and also CDONTS for forms to email.I was just wondering if I were to swap to Linux hosting, how easy or hard ( would it be to change these pages from ASP to PHP with the exact same functionality.
I created a form to allow a visitor to add a new record to a database with the recordset object. Is there any conversion that needs to take place from the form input fields the user gives me to the recordset object? One of my form fields that I have is going to contain a money datatype in my SQL database and so far it's giving a 500 error.
My code in short looks like: strCurrentPrice=Request("currentPrice")
then upon adding to the database the code looks like: rsAddCards("currentPrice")=strCurrentPrice
I am calling a recordset from sql which happens to contain one column that is a datetime in the format: DD/MM/YYYY HH:MM:SS. So when I call that column from the db, it displays in the same format within my page.
However, I would like to be able to display the datetime as part of my recordset, but in a more aesthetically pleasing format (i.e: Sunday 1st May 2000, 7.23PM)
I have tried using the formatdatetime() function along with my rs, but this causes syntax errors. I know this is probably dead simple, but I don't get it!
I keep getting a type mismatch 'cdbl' error on the line: cmd_AlloUpdateM2__incrdecr = cdbl(cmd_AlloUpdateM2__incrdecr)
What's weird is I use this in other sections of my code and it works fine...no error. I've checked and re-checked the code and can't find the why this is happening?
Anyone have any code handy to convert a binary number to decimal and a decimal to binary? I need server-side code to perform these calculations. For example, I'd like to be able to pass 129 to a function and it will return 10000001. Likewise, I'd like to pass 10000001 to a function and get 129. I can do this on paper, just not sure where to start on how to pass these numbers into a function to perform the calculation.
I am in UK using XP with date format set to dd/mm/yy. I am running an asp site from a server in USA, which is returning the date from a database field retrieved as objrec("todate") in US format mm/dd/yy. To rectify this so as not to confuse visitors to the site I am trying to get the date displayed as dd month yy , e.g. 25 January 04 by using the format function format(objrec("todate"), "d-mmmm-yy"). This returns me a VBScript runtime error "Type mismatch: 'format' " The data base field "todate" is stored in short date format, which should be OK shouldnt it?
My database is being converted from Access to MySQL. My question is how do I maintain the database once the switch has taken place? Are there freeware MySQL administration GUI's or something? I'm a little clueless here.
I currently am using a script which submits full state names to a payment processor. However, the payment processor only accepts 2 digit state names. Does anyone have a premade code for asp that converts state names into 2 digit ones. Code: