
388
|
Chapter 18: The HttpServerUtility Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Methods Reference
ClearError
Server.ClearError( )
Clears the last exception thrown.
Parameters
None
Notes
The ClearError method is new to ASP.NET. You can use this method at the
beginning of page processing to clear the last exception so that the information
provided by the GetLastError method is specific to an exception occurring on the
current page.
CreateObject
objvar = Server.CreateObject(ProgID)
objvar = Server.CreateObject(Type)
Returns a reference to a COM object created based on the supplied ProgID.
Parameters
objvar
A variable of type Object to receive the reference to the newly created object.
ProgID
A String variable or literal containing the COM programmatic ID of the
desired object.
Type
The type name of a runtime callable wrapper (RCW) class that the tlbimp.exe
utility generated to expose a COM object to managed code.
Example
The code example declares an object variable, uses Server.CreateObject to assign
a reference to a newly created ADO Recordset object to the variable, and then
opens the recordset and returns the RecordCount property to the browser by
using the Message label control:
Sub Page_Load( )
Dim rs1
Dim ConnString As String
ConnString = "driver={SQL Server};server=(local)\NetSDK;"
ConnString = ConnString & "database=Pubs;Trusted_Connection=yes" ...