IMAT1604: Visual Web Development

DatabaseQuery Class

This class is third and final layer of the three layered architecture. It connects to the Database, and executes stored procedures in the database. Some of those procedures require SQL parameters such as the ID of the required record. Thus this class has a method to AddParameter() which adds one SQL parameter to a list of parameters, and two execute methods. Simple SQL Select stored procedure queries can be executed using the ExecuteSelect() method, and SQL INSERT, DELETE and UPDATE queries can be executed using the ExecuteUpdate() method.

C# DatabaseQuery Class

This code was originaly supplied by DMU as clsDataConnection, and it has been re-factored to simplify it, and to use the web.config file to provide the connection string to the database. This system is the standard way to make database connections in ASP.NET

Students do not need to understand the code in this class, they do, however need to understand how to use this class (see example in the WineList class). This code uses ADO.NET classes which is the original technology introduced over ten years ago. There are now newer and easier ways using Web Forms or MVC.