Type Mismatch Error Using the GetAd Method of Commerce.AdServer (245236)



The information in this article applies to:

  • Microsoft Site Server 3.0 Commerce Edition

This article was previously published under Q245236

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
				

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbpending kbprb KB245236