Passing parameters byref from VB to ASP

Results 1 to 3 of 3

Thread: Passing parameters byref from VB to ASP

  1. #1
    Join Date
    Dec 1969

    Default Passing parameters byref from VB to ASP

    Is anyone aware of any limitations in passing values &#039;ByRef&#039; from a VB COM component to ASP.<BR>I am returning a boolean value from my VB function which works fine but I also need to return a long value. I am trying to do this in the normal ByRef way but constantly get back nothing. I have debugged my VB function and the value is available and is propagated in the ByRef parameter but I cannot use this in my ASP page.<BR>Any suggestions gratefully received

  2. #2
    SPG Guest

    Default RE: Passing parameters byref from VB to ASP

    Here&#039;s an alternative approach:<BR><BR>function foo()<BR>a = MY_LONG_INT<BR>b = MY_BOOLEAN<BR>foo = array(a, b) &#039;pass back an array of variants<BR>end function<BR><BR>What this does for you is it decouples your COM object from your ASP script in terms of memory marshalling (which is a happy thing for efficiency -- it allows your ASP script to get its work done without fussing over what the COM object is doing with its variables and v.v.).<BR><BR>The other thing this does is it isolates programming styles on COM interfaces. VB variables have types -- like "date" and "boolean" and such. VBScript sort of has these same types, but in reality they&#039;re all just parsed strings which VBScript categorizes after the fact. The difference is that when VB passes a variable, it can say with certainty what it is passing -- VBScript can&#039;t. This makes it difficult for VB and VBScript to share variables ByRef, because while VBScript is trying to talk about a String in the form of a date, VB is trying to talk about a Date, no strings attached (then they generally say they&#039;re not talking about the same thing and throw a type mismatch).<BR><BR>To that end, if you hate your COM object and server, you could try<BR><BR>function foo(byref a as variant, byref b as variant)<BR><BR>but I&#039;m not certain that will work (it&#039;ll suck performance if it does) and I&#039;m certainly not advocating it (passing multiple variants is really bad style).

  3. #3
    John Zhuang Guest

    Default RE: Passing parameters byref from VB to ASP

    Try to declare the parameter as variant data type

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts