Lesson 1 - Introduction and prerequisites

What's in this course?

·        Connect your C# programs to a SQL database

·        Create business objects from the database's tables - including child business objects

·        Perform inserts and updates WITHOUT worrying about SQL injection attacks that could expose private data to hackers

·        Delete data from a database, and automatically delete its child data - preventing future problems with orphaned data

·        Call stored procedures from your program, passing in parameters and getting back results from the database

·        Securely store passwords in the database, in a way that will even prevent the Database Administrators from knowing your users' passwords

What's not in this course?

·       All the many different commands and queries available for SQL. This course is focused on just the C# code needed to work with a SQL database. It does not cover how to write complex SQL statements, stored procedures, etc.

·       How to do database administration tasks, like backups, restores, etc.


This course assumes you are already familiar with C#, but you don't need to be an expert.

The UI for the demonstration program is WPF, but we won't be doing any coding in the UI for these lessons. If you understand textboxes and buttons in Windows Forms or ASP.NET, you'll understand how this program works with WPF.

The sample program uses .NET Core 6, but the database code will also work with .NET Framework - with one minor changes for older versions of the framework (which I'll mention when we get to it).

We'll use Visual Studio Community 2022, Microsoft SQL Server 2019, and Microsoft SQL Server Management Studio.

You can use Visual Studio Code if that's your preferred IDE. You can also use other SQL databases, like PostgreSQL. I will cover a few things about how to work with other database engines.