optional parameters in COM object methods 
Author Message
 optional parameters in COM object methods

Does anyone know how to cope with optional parameters in JS.
I am using SQL2000 ADO2.6 XML in an ASP. The following line works OK in VBScript

adoCmd.Execute , , adExecuteStream

all parameters here are optional, but we need to set the third one to do the new
XML dialect query with output to a stream. In JS I tried things like:

adoCmd.Execute( , , adExecuteStream);
adoCmd.Execute(null ,null , adExecuteStream);

The first is a syntax error, the second causes ADODB to complain.

If I set the second parameter with an empty array of parameters it tells me that
this is inconsistent with the setting of the third parameter. In the end I
created a small VBSCRIPT sub and called it from JS and this works . . .

<SCRIPT RUNAT=server language="vbscript">
Sub ExecStream()
        adoCmd.Execute , , adExecuteStream
End Sub

My ASP starts as follows:

<OBJECT RUNAT=server ID=adoCmd PROGID="ADODB.Command.2.6"></OBJECT>
. . .
<!--METADATA TYPE="TypeLib" FILE="C:\WINNT\System32\msxml3.dll"-->
. . .

Thus the adoCmd object is visible in both script blocks.

If anyone knows how to do this in JS, I would be very interested.

Sat, 28 Jun 2003 19:01:41 GMT  
 [ 1 post ] 

 Relevant Pages 

1. COM-Object in ASP with COM-Object as parameter

2. COM-Object in ASP with COM-Object as Parameter

3. Optional parameters in Methods

4. Optional parameter in a method

5. Optional parameter in jscript. (Variant optional - DISP_E_PARAMNOTFOUND)

6. Passing optional object arguments from COM components

7. use of automation object methods with optional arguments

8. Out parameters from COM methods

9. Invoking a COM method that has a SafeArray as a parameter

10. Changing values of COM method parameters?

11. JSCript and returning parameters from COM object

12. Passing a String as a parameter to a (VB-) COM-Object


Powered by phpBB® Forum Software