Intro to SQL Server with ASP.NET - Page 1
       by kirupa  |  25 December 2006

When deciding which database to use with ASP.net, a common choice is to use Microsoft's own SQL Server. I prefer SQL Server because it integrates nicely with Visual Studio, and if you are just starting out learning how to use databases with your web site, you will appreciate many of tasks that are automated for you.

In this tutorial, I will explain how to create a simple data-driven web site that allows you to add data to and view data from a SQL Express 2005 database. There are many great tutorials on the web that outline how to use the Visual Studio wizards to accomplish this really easily, so I will provide a more code-oriented approach so that you have a better idea of how some of these things really work.

As a survey of what you will create, here is a birds-eye view of what our project will look like:

You will create two pages - one for sending data to the database (Games.aspx) and another page for retrieving data (Results.aspx) from the database. In order to get that to work, you will need to setup the database and specify the connection between them. Don't worry, for this tutorial will explain in great detail how to do all of this.

Getting Started
Before we begin, make sure you have the free Visual Web Developer and SQL Server Express 2005 installed. These programs feature most of the features of their full-version counterparts, so these programs are great for exploring .NET and for easily porting to their fully-featured counterparts in the future:

Next, make sure you have IIS running and accessible via localhost. If you are not familiar with how to setup IIS, this tutorial should help you out: Learn how to setup IIS.

On the Menu
In this tutorial I will divide the main topics into the following sections:

  1. Setting up the Database
  2. Setting up the Connection String
  3. Creating the Input Form
  4. Retrieving values from the Database
  5. Explaining the Code
  6. Conclusion

With this said, we'll start the tutorial on the next page.

Onwards to the next page!

1 | 2 | 3 | 4 | 5 | 6




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.