CSharp Web Page

ASP.NET Web Application
Do this tutorial series here from 'Tutorial What is ASP.net...' through 'Tutorial: Insert, Update, Delete ...'
For 'Tutorial: User Control Examples', stop when you get to 'Registering asp.net controls globally in the web config configuration file asp', as it does not work well beyond that point.
For 'Tutorial: Insert, Update, Delete...' also refer to the directions below, as we will be using a MySQL database instead, so the steps will be somewhat different.

When you first choose your project type in Visual Studio 2019, be sure to pick: "ASP.NET Web Appication (.NET Framework)"

Goal: When you are done, you should be able to connect to some sql database. That database should have a table with at least two fields, and at least two rows of data. Your web page should be able to display the fields of data, row by row. Your web page should allow more rows to be inserted. Your web page should allow rows to be updated and deleted. It doesn't have to be pretty, but it should be fully functional.
Special thanks to Stratton McDonald for providing us access to his MySql Database domain and Database this semester.
You are welcome to use his, or your own.
His access information is as follows:
Database name: cs3500TestDB
Database user: cs3500
Database password: V67Jo&VQxcq#
Database domain: database.makebettermedia.org

Start by connecting to his database domain.
You can do this from nitrogen.cs.dixie.edu by typing the following:
mysql -hdatabase.makebettermedia.org -ucs3500 -p
Then enter the password from above.

At this point, you should have a mysql prompt.
You will need to switch to his database and make yourself a table within that database.
Use your own name so you are not stomping on other students.
Please be polite.
If your Name were Sally Smith, you could type the following:
USE cs3500TestDB
CREATE TABLE SallySmith (TutorialID int, TutorialName VARCHAR(20));
DESCRIBE SallySmith;
INSERT INTO SallySmith VALUES (1,'C#');
INSERT INTO SallySmith VALUES (2, 'ASP.Net');

Now you can return to the Database Connection Tutorial, but the commands are all different for MySQL.
To make a connection and read the data you just created, your Page_Load method in Demo.aspx.cs should look like this:

protected void Page_Load(object sender, EventArgs e)
	// Open Database Connection:
	string connStr = "server=database.makebettermedia.org;user=cs3500;database=cs3500TestDB;password=V67Jo&VQxcq#";
	MySqlConnection conn = new MySqlConnection(connStr);
	System.Data.ConnectionState x = conn.State;
	Response.Write("Connection Made <br>");

	// Make a Query: 
	MySqlCommand cmd = new MySqlCommand("select * from SallySmith;", conn);
	using (var reader = cmd.ExecuteReader())
 		while (reader.Read())
			int Id = Convert.ToInt32(reader["TutorialId"]);
			string Name = reader["TutorialName"].ToString();
			Response.Write(Id + " " + Name + "<br>");
You will also need this line at the top:
using MySql.Data.MySqlClient;

And you will need a NuGet package for MySQL, which I will show you how to do in class.

To Insert data, I used added several control widgets to my web page, and the Insert button used this code:
        protected void btnInsert_Click(object sender, EventArgs e)
            Response.Write("Inserting " + txtDataID.Text + " and " + txtDataName.Text);
            MySqlCommand cmd = new MySqlCommand("Insert into SallySmith (TutorialId,TutorialName)  values(@Id, @Name)", conn);  
            cmd.Parameters.AddWithValue("@Id", txtDataID.Text);
            cmd.Parameters.AddWithValue("@Name", txtDataName.Text);

            Server.TransferRequest(Request.Url.AbsolutePath, false); // refresh the page
I had to increase the scope of this variable
MySqlConnection conn;
which was previously declared at the Page_Load level (above) to the namespace level.

Add similar controls and functionality for Update and Delete to finish this assignment.

To install SQL Server Express 2019, follow the directions in this YouTube video: Install SQL Server Express