繁体   English   中英

如何在分配和不分配变量的情况下调用单个经典 ASP 参数化函数? 没有呼叫

[英]How can i call Single Classic ASP Parameterized Function With and Without Assigning to Variable? Without CALL

我在 Classic Asp 中定义了一个带参数的函数,它返回值。

不使用 CALL 调用两次经典 ASP 函数

1.存储返回值

2.不存储返回值(不像CALL函数名)

 Function concatenate(first, last, operation)
    Dim full
    full = first & last
    IF operation="I" THEN
      'Storing the value in database and returning Result Set
       concatenate = conn.Execute(full)
    END IF
    IF operation="U" THEN
      'Updating the value in database without returning Result Set
       conn.Execute(full)
    END IF
  End Function

  ' Here is the usage of returning value from function. 
  dim rs
  SET rs= concatenate("First", "Last", "I") 'Executing Correctly
  CALL concatenate("First", "Last", "I")    'Executing But not my requirement Because need to change many times Cause by Just adding a Parameter
  concatenate("First", "Last", "U")          'Compilation Error

我们如何在不存储值的情况下调用相同的函数。? 请帮助我了解这个经典的 ASP 函数

这里有很多错误信息,您不必更改函数内部的任何内容,函数可以根据您的调用方式返回或不返回值。

'Don't return a value
 concatenate "First", "Last", "U"

 'If you still want to call with parentheses
 Call concatenate("First", "Last", "U") 

如果您想知道为什么会这样;

'What no "cannot use parentheses" error??
concatenate("First")

那么这里有一些简单的阅读给你。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM