Type Mismatch Error Using the GetAd Method of Commerce.AdServer

ID: Q245236


The information in this article applies to:
  • Microsoft Site Server version 3.0, Commerce Edition


SYMPTOMS

You may receive a type mismatch error when trying to call the GetAd method of the Commerce.AdServer object from JavaScript and you are passing in a TagList.


CAUSE

AdServer is expecting a variant array for the TagList parameter. JavaScript is passing the array as a dispatch pointer to a SimpleList object.


RESOLUTION

You cannot call the GetAd method from JavaScript directly if you are specifying a TagList. Instead, create a VBScript function that performs the communication with the AdServer object. You can then call this function from within your JavaScript.

Here is an example:


<%@ Language = JavaScript %>

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Function GetAd ()
	Set oAD  = Application ("Ad")
	aArray = array ("position.banner.bottom")
	GetAd = oAD.GetAd (Response, aArray)
End Function
</SCRIPT>

' ... code before ad is to be displayed goes here

<% Response.Write (GetMyAd ()); %>

' ... code after ad is to be displayed goes here 

Additional query words:

Keywords :
Version : winnt:3.0
Platform : winnt
Issue type : kbprb


Last Reviewed: January 13, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.