DB Web Applications  «Prev  Next»

Lesson 1

Database Web Applications

Welcome to Creating Database Web Applications Using Web Technologies.
The most popular web sites on the internet are data-driven. Ecommerce storefronts, membership sites, corporate intranets, and even a simple contact form all depend on a database somewhere behind the scenes. So do a great many things that do not look like "a database application" at first glance: a blog's list of posts and comments, a job board's listing of open positions, a support desk's queue of open tickets, a SaaS dashboard's chart of this month's usage, and a school's internal portal for grades and attendance all come down to the same underlying pattern. A product catalog is really a table of rows. A shopping cart is a handful of rows tied to a session. A login screen is a lookup against a table of credentials. Once you can see a web page this way, as a view onto rows that live in a database, the rest of this course is really just learning the mechanics of getting those rows onto the page and back again.

This course introduces you to database functionality for your web pages. You will learn how to integrate a relational database into a site using three complementary pieces:
  1. SQL, the language every one of these pages ultimately speaks to the database,
  2. a page-level framework for binding query results to markup and handling user input, and
  3. server-side data access code that actually opens the connection, runs the command, and hands the results back to the page.
Those three pieces have not changed in twenty five years. What has changed, more than once, is which specific technologies fill each role. This course was originally written around one specific answer to that question. This lesson exists to explain what that original answer was, why it no longer applies, and what this course uses instead.

A Short History: Why This Course Looked Different Twenty Five Years Ago

When this course was first written, Microsoft's answer to all three pieces above was Visual InterDev, Classic ASP, and VBScript, running against SQL Server 7. Visual InterDev shipped as part of Visual Studio 97, and a substantially redesigned version shipped again in Visual Studio 6.0 the following year. It was an integrated development environment built specifically around Active Server Pages development: it offered code completion, database server management tools, an integrated debugger, HTML authoring support, and features for coordinating a web project across a team. For its era, it was a genuinely capable tool, and a great deal of production ecommerce and intranet software was built with it.

Part of what Visual InterDev offered, and what the second item in this course's original list of three pieces referred to, were design-time controls. These were components you dropped onto a page inside the Visual InterDev designer that generated the HTML and scripting needed to connect to a data source and display its results, without you hand-writing every line yourself. They worked, but they generated code directly into the page, tied tightly to a specific designer, and did not travel well once Microsoft moved on from Classic ASP. Nothing in the current ASP.NET Core world is called a design-time control, because the underlying approach, generating markup for you inside the IDE's designer, was largely abandoned in favor of markup you write yourself with help from the framework rather than instead of it. That is exactly the gap Razor Pages fills today, discussed further below.

Visual InterDev did not survive past version 6.0 as its own branded product, though. Its capabilities were absorbed into Visual Studio .NET when Microsoft released it in 2002, and ASP.NET replaced Classic ASP as Microsoft's primary framework for building dynamic web applications. ASP.NET brought compiled code instead of interpreted scripts, meaningfully better performance, and a much richer set of server-side controls for building pages. VBScript, the scripting language Classic ASP pages were written in, gave way to full languages like C# and Visual Basic .NET running on a real managed runtime.

That transition, Classic ASP and VBScript giving way to ASP.NET and a real compiled language, is exactly the kind of transition that happens more than once in a technology's lifetime. It happened again. Microsoft has since moved on from the original, Windows-only ASP.NET Framework to ASP.NET Core, a ground-up rewrite that runs cross-platform, is open source, and is where essentially all current Microsoft web development investment goes. ASP.NET Core applications run on Windows, Linux, and macOS, can be hosted in a Docker container as easily as on a Windows Server box, and are generally faster at handling requests than either Classic ASP or the original ASP.NET Framework ever were, largely because of work Microsoft has put into the underlying runtime over more than a decade of yearly .NET releases. This course is being rewritten to reflect that second transition, the same way an earlier version of this very course would have needed rewriting to reflect the first one.

The Stack This Course Uses Now

Rather than attempt a one-for-one swap of each old technology for whatever replaced it most recently, this course uses the current, actively supported generation of each piece, chosen to match as closely as possible how the original course was structured. The table below lines up what this course used to teach against what it teaches now:

RoleOriginal (circa 1999)Current
IDEVisual InterDevVisual Studio 2026
Web frameworkClassic ASPASP.NET Core Razor Pages (.NET 10)
LanguageVBScriptC#
Data accessADO RecordsetsADO.NET, then Entity Framework Core
DatabaseSQL Server 7SQL Server 2025

Concretely, the current stack means:
  • Visual Studio 2026 as the development environment, running on .NET 10, the current long-term-support release of .NET. .NET 10 shipped in November 2025 and is supported for three years, which matters for a course: it means the examples here will still build and run on a fully supported platform for the life of this course, rather than on a version that is already sliding toward end of support the day the course goes live. Visual Studio 2026 itself launched alongside .NET 10 with a redesigned interface, a notably faster solution load and build experience compared to Visual Studio 2022, and deeper integration of AI-assisted coding tools directly into the editor. None of that is required to follow this course, a text editor and a command-line build would technically work too, but the productivity features are worth using once you are comfortable with what they are actually doing underneath.
  • ASP.NET Core Razor Pages as the web framework, in place of Classic ASP. Razor Pages was chosen deliberately over the two other common ASP.NET Core choices, MVC and Blazor, because it is the closest architectural match to what Classic ASP actually did: each page in a Razor Pages application is still its own file, with its own markup and its own server-side logic living right alongside it, the same mental model this course's original Classic ASP pages used. MVC splits that same logic across separate controller, model, and view files, which is a fine pattern but a bigger conceptual jump from where this course starts. Blazor goes further still, replacing most of the page-refresh model entirely with a component-based, often client-rendered approach. Razor Pages gets you into ASP.NET Core without throwing out the page-at-a-time intuition this course is built on.

    The resemblance is easier to see than to describe. A Classic ASP page that greeted a logged-in user might have looked roughly like this:
    <%
    Dim rs
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open "SELECT FirstName FROM Users WHERE UserID = " & Request("id"), conn
    Response.Write "Hello, " & rs("FirstName")
    %>
    A Razor Page doing the same thing separates the server-side code from the markup slightly more cleanly, but it is still one page, still runs top to bottom on a request, and still ends by handing finished HTML back to the browser:
    // Index.cshtml.cs
    public class IndexModel : PageModel
    {
        public string FirstName { get; set; }
        public void OnGet(int id)
        {
            FirstName = _userService.GetFirstName(id);
        }
    }
    <!-- Index.cshtml -->
    <p>Hello, @Model.FirstName</p>
    Neither snippet above is meant to run as written; they exist only to make the comparison concrete. The point is the shape: a page, a request, some server-side logic that fetches a value, and markup that displays it. That shape survived the transition from Classic ASP to ASP.NET Core even though almost every detail underneath it changed.
  • C# as the language, in place of VBScript. C# is a full, modern, strongly typed language with the kind of tooling, debugging support, and ecosystem VBScript never had.
  • SQL Server 2025 as the database engine, in place of SQL Server 7. Every SQL concept this course teaches, from basic queries through joins, computed columns, stored procedures, and indexing, runs against this current version.
  • ADO.NET first, then Entity Framework Core, as the server-side data access layer, in place of the ADO Recordset objects the original course used. This course deliberately teaches both, in that order, rather than picking one and skipping the other.
That last point is worth explaining, since it is a real decision rather than an arbitrary one. The original course taught ADO Recordsets directly: open a connection, execute a SQL statement, walk the resulting rows one at a time. ADO.NET is the direct, spiritual successor to that approach. You open a connection object, you build a command with explicit SQL text, you execute it, and you read the results back, typically row by row through a data reader. If you already understood how Recordsets worked, ADO.NET will feel immediately familiar, just with better typing and a cleaner object model. Because of that resemblance, this course teaches ADO.NET first, as the most direct bridge from the old approach to the new one.

Entity Framework Core, introduced later in this course, is a different way of working entirely: an object-relational mapper that lets you query and update the database by working with C# objects and letting EF Core generate the SQL underneath. Rather than writing SELECT FirstName FROM Customers WHERE CustomerID = 101 by hand, you would instead write something closer to context.Customers.Find(101) and let EF Core translate that into the equivalent SQL for you. EF Core supports two broad starting points: a code-first approach, where you define C# classes and let EF Core generate the matching database tables, and a database-first approach, where an existing database like the one this course builds up through its SQL lessons gets reverse-engineered into matching C# classes. This course uses the database-first approach when EF Core is introduced, since by then you will already have a real SQL Server database with real tables, built by hand, that EF Core can map onto directly.

EF Core is genuinely the pattern most new ASP.NET Core applications use in production today, and it is worth knowing well, but it hides a layer of detail that ADO.NET makes explicit. Learning ADO.NET first means you understand what EF Core is actually doing for you once you get there, rather than treating it as a black box from day one.

SQL and CRUD Operations: The Constant Underneath Everything

Whatever sits above the database, whether that is a Classic ASP page from 1999 or a Razor Pages application built on .NET 10 today, the database itself is ultimately being asked to do one of four things: create a row, read one or more rows back, update a row's values, or delete a row. Database professionals shorten this to CRUD: Create, Read, Update, Delete. Every data-driven feature you will ever build, a shopping cart, a user profile page, a blog's comment section, a support ticket system, reduces down to some combination of these four operations, expressed in SQL as INSERT, SELECT, UPDATE, and DELETE statements.

This course spends real time on SQL itself for exactly that reason. It is not enough to know that ADO.NET or Entity Framework Core can talk to a database; you need to know what to actually ask the database to do. In the simplest possible form, the four CRUD operations against a single Customers table look like this:
INSERT INTO Customers (FirstName, LastName, Email) VALUES ('Jane', 'Doe', 'jane@example.com');
SELECT FirstName, LastName FROM Customers WHERE CustomerID = 101;
UPDATE Customers SET Email = 'jane.doe@example.com' WHERE CustomerID = 101;
DELETE FROM Customers WHERE CustomerID = 101;
Real applications rarely stay this simple for long, which is why this course goes further: joining data across related tables, using computed columns so the database itself can derive a value rather than pushing that work into your C# code, calling stored procedures so logic that belongs on the database server stays there, and understanding how indexes affect the speed of the queries your pages run. SQL Server 2025 also adds capabilities well beyond what existed in SQL Server 7, including native support for JSON data, regular expression matching through functions like REGEXP_LIKE, and vector-based similarity search for the kind of semantic lookups that power modern recommendation and search features. This introductory course keeps its focus on the four CRUD operations and the fundamentals above, but later material in this course touches on where those newer capabilities fit once you have the basics solid.

For working with the database directly, outside of any web page, SQL Server Management Studio remains the primary tool this course uses for writing and testing T-SQL, but Azure Data Studio is worth knowing about as a lighter weight, cross-platform alternative built around the same underlying query engine. Either one is a reasonable place to try a query before wiring it into a Razor Page.

Why Learning This Still Matters

It would be fair to ask why a course built on a twenty five year old foundation is worth taking at all, rather than starting fresh with whatever is newest. The honest answer is that the foundation underneath this course, relational data, SQL, and a server-side page that reads and writes it, has outlasted every specific technology built on top of it so far. Classic ASP came and went. The original ASP.NET Framework is itself now a legacy technology that Microsoft no longer actively develops. SQL Server has moved from version 7 through a dozen major releases since. Through all of that, the relational model, and the SQL language used to work with it, has remained the dominant way organizations store and retrieve the data their applications depend on. Learning how a web page talks to a relational database, rather than memorizing the specific syntax of whichever framework happens to be current, is what keeps this kind of knowledge useful across however many more transitions Microsoft's web stack goes through next. The specific names in the table above, Razor Pages, C#, SQL Server 2025, will eventually be replaced by something else too. The pattern underneath them will very likely still be here.

Course Goals
After completing this course, you will be able to:
  1. Utilize relational databases in web pages
  2. Prepare SQL statements to query, update, and insert data via the web
  3. Use Razor Pages model binding and Tag Helpers to display database information
  4. Use ADO.NET, and later Entity Framework Core, to manipulate data from server-side C# code
  5. Take advantage of advanced query features including outer joins, computed columns, and stored procedures
  6. Use indexes to improve database performance

Key Terms From This Lesson

TermWhat It Means Here
CRUDCreate, Read, Update, Delete: the four basic operations any application performs against a database
Razor PagesAn ASP.NET Core web framework where each page is its own file combining markup and server-side C# code
ADO.NETThe lower-level .NET data access API: explicit connections, explicit SQL, explicit result reading
Entity Framework CoreAn object-relational mapper that lets C# code query and update the database through objects instead of raw SQL
Design-time controlA Visual InterDev-era component that generated page markup for data access inside the IDE's designer; no direct modern equivalent
Tag HelperThe closest modern replacement for a design-time control: server-side code that participates in writing HTML markup in a Razor Page

What's Ahead

The next lesson in this module covers what you will need in place before writing any code: installing Visual Studio 2026, getting a SQL Server 2025 instance available to connect to, and confirming the .NET 10 SDK is on your machine. From there, this course moves through the three pieces introduced here roughly in order: SQL fundamentals and the four CRUD operations against a real database, a first Razor Pages application that reads and displays those rows, data entry pages that write back to the database through ADO.NET, more advanced SQL covering joins, computed columns, stored procedures, and indexing, and finally a shift over to Entity Framework Core once the ADO.NET fundamentals underneath it are solid. If you have worked through a database course before, little of the underlying relational theory here will be unfamiliar. What is new is almost entirely in how that theory gets wired into a web page, and that wiring is this course's actual subject.

SEMrush Software 1 SEMrush Banner 1