MGSales.asp

The following is the source code for an ASP file that you should be able to use to test your MGSales COM server. You must have IIS or PWS running as discussed and demonstrated in class. This ASP file should be placed in a folder within your InetPub folder where there is executable and script security attirbutes.

Since this is just a school assignment, I would suggest that you run PWS, and then copy the ASP file to your \InetPub\wwwroot folder. In PWS Advanced settings, make sure the root folder has Execute and Script security options checked. If you do this, then in your browser you should be able to enter a URL of http://localhost/MGSales.asp in order to view the results.

Make sure you test your COM server thoroughly with your test program. Remember that the original documented form of the COM server was changed to use use a CDatabase and CClientSet pointer data member. This was key to making it usable to PWS. The source for the ASP file now follows:


<% @ LANGUAGE="VBSCRIPT" %>
<%
' This module is portion of the MGSales demonstration.
'
 OPTION EXPLICIT
 DIM Client
 DIM S
 DIM Q
 DIM i
	Q = Chr(34)
	'Create the Client object
	Set Client = Server.CreateObject( "MGSales.Client" )
	if Request.QueryString="SelectAll" or Request.QueryString="" then
		Client.SelectAll
	end if
	if Request.QueryString="SelectTop" then
		Client.SelectTop
	end if
	if Request.QueryString="SelectDeadBeat" then
		Client.SelectDeadBeat
	end if
	i = 0
	do until Client.LastClient <> 0
		S = Client.LastName + ", " + Client.FirstName
		Response.Write( S+ "<BR>" )
		Client.MoveNext
		i = i + 1
	loop
	Response.Write "<A HREF="+Q+"http://localhost/MGSales.ASP?SelectAll"+Q+">All</A> "
	Response.Write "<A HREF="+Q+"http://localhost/MGSales.ASP?SelectTop"+Q+">Top</A> "
	Response.Write "<A HREF="+Q+"http://localhost/MGSales.ASP?SelectDeadBeat"+Q+">DeadBeat</A><BR>"
	Set Client = Nothing

%>
<HTML>
<HEAD>
<BODY>
</BODY>
</HTML>