Home » ASP.NET Basics » 09 - Working with Data
9

Creating a Database for our site - Part 1

How to create databases: the basics

Before we can proceed with data handling, we need a database to store our product data. In this section, we will learn how to store data in a SQL Server 2005 Express database.

First, let us make a list of the data that we need to store. We will keep our database simple, so here is what we need to store:

  • ISBN - The International Standard Book Number of the book.
  • Book Name- The name of the book.
  • Author Name - Author of the book
  • Publisher Name - Publisher of the book
  • Category - Category of the book such as ASP.NET, C#, VB.NET etc.

We also need some sample data. The table shown below contains the details of some books. We will use this data for our project purpose.

ISBN

Title

Author

Publisher

Category

1590593375

ASP.NET 2.0 Revealed

Patrick Lorenz

Apress

ASP.NET

1590594967

Pro ASP.NET 2.0 in C# 2005

Matthew MacDonald

Apress

ASP.NET

1590595122

Pro ADO.NET 2.0

Sahil Malik

Apress

ADO.NET

1590595726

Beginning ASP.NET 2.0 in C# 2005: From Novice to Professional

Matthew MacDonald

Apress

ASP.NET

1590594193

Pro C# 2005 and the .NET 2.0 Platform, Third Edition

Andrew Toelsen

Apress

C#

1590596404

Pro Visual C++/CLI and the .NET 2.0 Platform

Stephen R.G. Fraser

Apress

C++.NET

1590594398

Pro .NET 2.0 Windows Forms and Custom Controls in C#

Matthew MacDonald

Apress

.NET Development

0471788139

Professional VSTO 2005 : Visual Studio 2005 Tools for Office

Alvin Bruney

Wrox

.NET Development

0470042583

Beginning ASP.NET 2.0 with C#

Chris Hart

Wrox

ASP.NET

0764575341

Professional C# 2005

Christian Nagel

Wrox

C#

0764578472

Beginning Visual C# 2005

Karli Watson

Wrox

C#

0764576100

Professional ASP.NET 2.0

Bill Evjen

Wrox

ASP.NET

0764575368

Professional VB 2005

Bill Evjen

Wrox

VB.NET

0764574019

Beginning Visual Basic 2005

Thearon Willis

Wrox

VB.NET

0735622019

Microsoft ASP.NET 2.0 Step By Step

George Shepherd

Microsoft

ASP.NET

0735621292

Microsoft Visual C# 2005 Step by Step

John Sharp

Microsoft

C#

0735621314

Microsoft Visual Basic 2005 Step by Step

Michael Halvorson

Microsoft

VB.NET

Now that we have some sample data, let us store this data in a database. As we have discussed earlier, we will use SQL Server 2005 Express Edition for the database. Note that although the database will be stored in SQL Server 2005 Express, we can access and work with the database through the VWD IDE.

We will now create a database and add a table in it for storing the data:

  • Open the project if it is not already open. Move the mouse pointer on the `Database Explorer' tab to make it visible. As shown in the figure below, right click on the Data Connections and select the Add Connection... option from the menu.