A CDbl()
Can I convert a string to a double instead of an integer? I have a value of 5.5 and when I use the cInt it rounds it off to 6.
View RepliesCan I convert a string to a double instead of an integer? I have a value of 5.5 and when I use the cInt it rounds it off to 6.
View RepliesI've been away from ASP so long that i don't remember the basics anymore but I'll do anything you want in Lisp.
I have a string "15.00" that I'm converting to a doube using CDbl("15.00") so it spits out 15 instead of 15.00. How do I ensure 2 decimal places for any number
I have a money datatype field in a SQL Server database.
I use the following method to take a value passed in the Request.Form collection and convert it to the double datatype:
cmd_AlloUpdateM2__incrdecr = Request("incrdecrA" & a)
cmd_AlloUpdateM2__incrdecr = replace(cmd_AlloUpdateM2__incrdecr,"$","")
cmd_AlloUpdateM2__incrdecr = replace(cmd_AlloUpdateM2__incrdecr,",","")
cmd_AlloUpdateM2__incrdecr = cdbl(cmd_AlloUpdateM2__incrdecr)
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?
I'm grabbing data from an XML web service and storing the values in ASP variables. I'm trying to apply the cDbl function to values returned and I'm getting the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'cDbl'
The data prints to the screen just fine
I understand that all asp classic vars are variants and to always make sure that you are working with the type that you want it is best to use these built-in Cxx() functions, but I'm confused about whether I should use CSng or CDbl for my calcs.
I don't think they will ever be more than say 6 decimal places (at the very most usually 2 or 3) and the value the other way won't be in the millions (chance would be a fine thing!!) so should I be using CSng or CDbl? Is there any kind of performance degradation in using one over the other? Is there any kind of accuracy degradation in using one over the other?
I have login page that fails the login on the validate page and gives me the Type mismatch: 'CDbl' error.What I find funny is that I didn't notice that was happening until I assigned one User a longer password (xxxxxxxxx2004) but if I login in with password for another user and they have been using this (xxxxxx2004) then everything is fine.
I can't see the code to be the problem or can it. Password field is a varchar (200).
Would somebody have a suggestion,because earlier in the day I was able to create a smaller lenght wise password for this case and it worked if I do that now it fails as if I have incorrect userName or password.