|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.
|
|
#1
|
|||
|
|||
|
ASP Function overwriting the parameter variable
Hey Everyone,
I have run into an issue where an ASP function is acting as if I am sending a variable as ByRef, but I am not. Here is the function: function convertToMetric(strImperialValue) if isNull(strImperialValue) then strImperialValue = "" if isNumeric(strImperialValue) then strImperialValue = cdbl(cdbl(strImperialValue) / 0.03937) convertToMetric = strImperialValueend function Expected use: varMetric = convertToMetric(varImperial) & " mm" varMetric does get set to the metric value, but so does varImperial I can fix the problem by changing the code to the following: function convertToMetric(strImperialValue) dim strVal strVal = strImperialValue if isNull(strVal) then strVal= "" if isNumeric(strVal) then strVal= cdbl(cdbl(strVal) / 0.03937) convertToMetric = strValend function I would like to know what is causing the problem as I use nearly identical functions elsewhere without any issues. Any ideas? Thanks, Dan |
|
#2
|
|||
|
|||
|
Also, adding ByVal to the function seemed to work.
I've never had classic ASP require me to pass ByVal before though. |
|
#3
|
|||
|
|||
|
After further reading, apparently ASP defaults to ByRef - never read this before
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > ASP Function overwriting the parameter variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
![]() |
|