The last few weeks I have spent a lot of time training junior developers and giving introduction courses into ASP.Net Web Development. One of the most powerful features of ASP.Net 2.0 is the ability to retrieve and view data from the database, make updates and inserts, and delete data without having to write any actual code. The power of this is nicely illustrated by the To Do List sample at ASP.Net AJAX.
Since I tend to repeat myself often lately when it comes to how to do this I decided to put together a little web application and post the source code and step here, showing how simply a new web application can be put together. I am going to use a simple example, we will be creating a Contact Manager to keep track of a list of names and telephone numbers. The tools you will need to complete this project with are freely available.
Step 1: Creating the Database
The first step in creating this application is to create the data store. We will be using Microsoft SQL Express as the database to store all the information we require. It's free for download although it does contain certain limitations. To create the database we will be using SQL Server Manager Express. At this point we will assume you already have successfully installed both on your machine and all the required links have been created.
1. Open SQL Server Manager Express - You should see a screen as follows:
Server Type refers to the type of SQL server I want to connect to. The default is adequate for our purpose.
Server Name refers to the machine I want to connect to. This can be either my machine name, (localhost) or . for our purposes
Authentication Method By default Windows Authentication should work fine alternatively select SQL Authentication
Username SQL Authentication Username
Password SQL Authentication Password
This connection dialogue is standard across all version of the Management Studio. It allows you to connect to any SQL Server and Service based on your selection. The authentication method depends on each installation of SQL Server. Windows Authentications indicates that your username and password you use to log onto your machine or domain will be used to log onto the server. You can also create SQL usernames and passwords, and choose SQL Authentication to use these to log on. Database access usernames or roles. SQL is extremely flexible in this regard.
2. With everything set to default you can just click connect at this point which should log you into the server on your local machine.
3. Firstly we need to create a new database to store all the relevant information in.
In the Object Explorer left click on the + next to your machine or server name.
Right click on the Database option to access the New Database option
Left click on the New Database option
A database is a collection of tables that is used to store information. There are various types of databases including MySQL, FirebirdSQL, Oracle apart from Microsoft SQL Server. Each table in a database consists of a set of columns that define the information to be stored within the table, and a number of rows containing the actual data. Databases provides powerful functionality, including the ability to index columns for speed, define unique keys for each row of data, ensures data integrity, central data management, data relationships and more.
Microsoft SQL Databases can also contain views, stored procedures, functions and database diagrams. There is a strong security model included that allows for access control down to table level allowing permissions to be set to a user or role. This offers a various different ways to ensure data security and access. Data can also be imported and exported from other SQL database as well as Excel, CSV, Tab-Delimited Text files to name a few.
For people interested in learning more about SQL Server and possibly wanting to become Database Administrators have a look at the MCTS: SQL Server 2005 and MCTS: SQL Server 2005 Business Intelligence courses. Microsoft Certified Technology Specialist courses are focused on .Net Framework 2.0, Visual Studio 2005 and SQL Server 2005 and is internationally recognized.
4. Give the database an understandable name like ContactManager and click on OK.

5. Select the ContactManager Database under the Databases option in the Object Explorer by left clicking on the name and then left click the + next to it. During this series we will be working with:
Database Diagrams can be used to visually map the relationship between various tables. This can later be exported and also assist with the creation of foreign keys
Tables are the actual data stores for the database. A database can have as many tables as required by the application
Views are read only versions of tables, usually used to simplify complex queries or for reporting
Programmability contains all Stored Procedures and other code related options
And that is the end of Part 1. In an effort to keep the tutorials short and detailed I will be breaking focusing on core pieces of the process with each tutorial. If all goes well I will be able to post a part each day until we have our completed Contact Manager.