JScript, VBScript and ASP 
Author Message
 JScript, VBScript and ASP

I am trying to use my own COM object in ASP.   As a C++ programmer, I prefer
to use Javascript as the server side scripting language.  However, I ran
into a lot of trouble to pass data between Javascript and my COM object.

I.e. following code works with VBScript

    Dim erCode, array
    erCode = Session("MyCom").GetGroup(array)

"array" contains a valid list of elements after GetGroup call.

In Javascript, I wrote the equivalent

    var erCode, array
    erCode = Session("MyCom").GetGroup(array)

"array" contains an "undefined" object (using typeof) after the GetGroup
call.  The problem is not limited to array data - I wasn't able to get any
type of data (string, long) from com object in Javascript.

I also ran into trouble trying to pass data from scripting language to my
com object, even with VBScript.  Searching through MSDN did not reveal much
usuful information.  Does anyone know a good book or website that has a
detailed coverage on this topic?

Help greatly appreciated.



Fri, 25 Jul 2003 15:00:22 GMT  
 JScript, VBScript and ASP
Jscript can't pass parameters of a method to COM by reference.  You will
have to write a VBScript function to wrap it, or implement your COM object
in a way that you can pass an array back from a member function call, but
not as a by ref parameter.

Richard


Quote:
> I am trying to use my own COM object in ASP.   As a C++ programmer, I
prefer
> to use Javascript as the server side scripting language.  However, I ran
> into a lot of trouble to pass data between Javascript and my COM object.

> I.e. following code works with VBScript

>     Dim erCode, array
>     erCode = Session("MyCom").GetGroup(array)

> "array" contains a valid list of elements after GetGroup call.

> In Javascript, I wrote the equivalent

>     var erCode, array
>     erCode = Session("MyCom").GetGroup(array)

> "array" contains an "undefined" object (using typeof) after the GetGroup
> call.  The problem is not limited to array data - I wasn't able to get any
> type of data (string, long) from com object in Javascript.

> I also ran into trouble trying to pass data from scripting language to my
> com object, even with VBScript.  Searching through MSDN did not reveal
much
> usuful information.  Does anyone know a good book or website that has a
> detailed coverage on this topic?

> Help greatly appreciated.



Fri, 25 Jul 2003 15:35:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Vbscript class in jscript page (ASP)

2. calling ASP from within VBScript/JScript ???????

3. How to use a variable from a JScript in a VBScript in the same asp file

4. passing a JScript variable to ASP (Vbscript)

5. VBScript and JScript in same ASP page

6. How to pass an n-dim array from VBScript to JScript within an ASP page

7. JScript as ASP language instead of VBScript

8. JScript as ASP language instead of VBScript

9. Accessing VBScript from JScript and vice versa in ASP

10. Jscript vs VBscript on server side (ASP)

11. Accessing VBScript from JScript and vice versa in ASP

12. ASP: VBScript or JScript?

 

 
Powered by phpBB® Forum Software