January 27, 2003

DbObject – A base data class for common DB operations

‘ A base data class that makes it much easier for derived classes to run a ‘ stored procedure to retrieve data or execute a SQL command. (See usage ‘ examples at the bottom)Imports SystemImports System.DataImports System.Data.SqlClient’ DbObject is the class from which all classes in the Data Services Tier’

Accessing user controls from the code-behind

When you add a user control to an ASP.NET page, Visual Studio .NET does not add a control declaration as it does when you add standard ASP.NET web controls. The result is that you can’t directly access the user control from the code-behind and programmatically change its properties and call

LogEvent – Logging an error/event to the Windows NT/2000 Application Event Log

‘ Log an error/event to the Windows NT/2000 Application Event Log.’ Usage: LogEvent(“Message here”, EventLogEntryType.Information)Sub LogEvent(ByVal message As String, ByVal entryType As EventLogEntryType) If EventLog.SourceExists(Application.ProductName) = False Then EventLog.CreateEventSource(Application.ProductName, “Application”) End If EventLog.WriteEntry(Application.ProductName, message, entryType)End Sub’ This code is taken from Marco Bellinaso’s and Kevin Hoffman’s “ASP.NET ‘ Website Programming

Redirecting to the real referrer page during a postback

Say that you have a page loaded from another page, and that in this page you have a “Save and Return” button that does something and returns to the previous page. For example you may have an Orders page that loads a Details page, where you make some changes and

AppException – An extended Exception class that logs the errors to file

‘ This class extends the base Exception class with a static method (callable ‘ also without creating and throwing an instance of this exception class) to ‘ log the contents of the exception to a file.’ Notes:’ A custom key named ErrorLogFile must be added to the section,’ within the