|
All of us need feedback to improve, and our applications are no different. If the users of
our applications are experiencing issues, we need a reliable and verifiable method of recording
and reporting these errors.
I created a simple table called ‘ErrorLog’ in Microsoft SQL Server (easily transferable to Microsoft
Access) and then referenced that table in my Iron Speed Designer application.
I then created a simple class called Support.vb to house my error log subroutine. I added
the following code to this class:
However, after I created the function and started using it, I realized that I was going to have
to declare my support object every time I wanted to use it on a particular page. That, I decided,
was too tedious and time consuming. Instead, I discovered that the right place to put common routines
is the BaseApplicationPage class. There are also base pages for table and record controls as well.
You can access the base pages here, under the Shared folder:
Using Microsoft Visual Studio, I opened the BaseApplicationPage.vb file and added the following
code right after the Inherits declaration.
This makes my support object available across all Iron Speed Designer pages! Alas, the problem
arose again when I wanted to access my support object from within an App_Code page. However, adding
a single line of code into the Table and Record Base Pages solves the problem:
And our table control page...
Now we are ready to use our new support object for error handling. You will have created the table
in Microsoft SQL Server or Microsoft Access and referenced this table in Iron Speed Designer. You
will have created the Support.vb file (or C# equivalent) and placed it at the root of the App_Code
folder.
Example Use:
Note that I am also passing in the current function/subroutine and the logged-in user ID as well.
You can also go another step further and add this into the Iron Speed Designer project templates,
so that all new applications have this code automatically included.
You can also copy your support.vb (or equivalent support.cs) file into the following directory:
Placing your file here allows Iron Speed Designer to copy it into your new application folder.
You will have to do this for every version of Iron Speed Designer that you install.
|