If you followed my lead on Friday you'll have installed everything you need to developer in ASP.NET.
Now - assuming you remembered to include it as part of the install - launch SQL Server Management Studio. First thing you'll see is a login screen, as below:
In the Server Name field put COMPUTERNAME\SQLEXPRESS or try LOCALHOST\SQLEXPRESS if you don't know your computer's name. Enter the password you chose during install and press connect.
Once connected. Right click the Databases folder in the left-hand pane and choose New Database. You'll see a box, like below, in which you can name it Zoo and press OK.
Now, find the Tables folder within your new database, right click it and add a new Table. Add some columns, like below.
These columns will likely change as we go along, but, for now, we just want to get up and running.
With these rudimentary columns in place, we need to configure the table's "ID" column. First thing we need to do is make it a Primary Key. To do this, right click the animal_id column and choose Set Primary Key.
Now, we need to tell the ID column to "auto increment". In MySQL tools, such as the brilliant HeidiSQL, this is fairly obvious how to achieve. In SQL Server it took me a while to work out that you need to find the "Identity Specification" section of the Column Properties and change "Is Identity" to Yes.
For those of you unfamiliar with SQL, a column that is an identity gets auto-incremented each time you add a row. When you add the first row, the ID column value is 1. For the second row it's 2. Etc. You don't need to specify these values, the SQL system does it for you.
Now, we need to add a Database Diagram to define relationships between tables. It's not really essential at this point (where we have no inter-table relationships to define) but it will come in handy later on in helping build a DataSet in Visual Studio.
On the Database Diagrams section of your database right click and add a new diagram. Add the Animals table it and save (name isn't important really).
Before we finish let's quickly add some data. Right click the table and choose "Edit Top 200 Rows". You can then type in "raw" values in to each column. Press the down arrow to move to a new row.
Note that you don't need to add values to the animal_id column as it will auto increment these for us. Just leave its value as NULL.
There's no need to save the table after entering values. As you go the values and entries are automatically updated to the database!
In the next post we'll create a new project in Visual Studio, connect it to SQL Server and then build a DataSet.
At this point it might be worth pointing out that I don't proclaim to be an ASP.NET expert. Nor am I - by any means - a SQL (or SQL Server) guru. I'm somewhere above average, if I dare say so.
What I'm describing here is the point I'm at in my learnings. It's the approach I'm using at the moment and is constantly changing as I learn more and better ways of doing things. I'm not saying it's the best way, but it's the way I'm happy doing things after about 18 months at it. In that time I've made quite a few "mistakes", so at least if you follow along you should avoid making any of them.
If along the way you think you know a better way or see me making glaring mistakes. Please, please say.