Adding SQL to SuperAdventure
When we add the SQL Server code to SuperAdventure, we will check to see if the database exists. If it doesn’t, the program will continue to use the XML file to save the player’s game data.
This way, people can still use the program if they don’t want to install SQL Server.
Which SQL database engine?
For these SQL lessons, I will use Microsoft SQL Server 2014.
If you use one of the other SQL database engines, there will be a few small differences. I will try to mention the areas that work different from Microsoft SQL Server. If you see a problem, please leave a comment below the lesson. I will try to find an answer to get your SQL engine working.
Preparing to install Microsoft SQL Server
It’s best to install SQL Server before installing Visual Studio. However, if you are at this point in the lessons, you already Visual Studio installed. So, we will install SQL Server now.
Before installing Microsoft SQL Server, you need to install version 3.5 of the .NET Framework. You even need to do it if you have a newer version installed. SQL Server has some specific things it needs from version 3.5.
The video below shows how to install .NET 3.5.
Or, you can open your Control Panel, go to Programs and Features, select “Turn Windows features on or off”, and check the box for “.NET Framework 3.5 (includes .NET 2.0 and 3.0)”. This will try to install the 3.5 Framework from your Windows installation disks, or from the Internet.
Microsoft SQL Server installation video
Here is a video that shows how to install Microsoft SQL Server 2014.
Parts of SQL Server
There are usually two things you install, when you install any SQL program – the database engine and the management tool.
The database engine is the program that runs in the background. It’s always running, but it does not have a user interface. This is what your program uses to save and retrieve data.
The management tool has a user interface. It lets you easily manage your databases. Microsoft named theirs, “Microsoft SQL Server Management Studio”. This is the program we will use to create the tables in our database. If you use a different SQL engine, they will probably have their own management program.
Next lesson: Lesson 22.2 – Creating database tables from classes
Previous lesson: Lesson 21.4 – Completing the trading screen
All lessons: Learn C# by Building a Simple RPG Index