Datasheet
The default database created using the new membership features of ASP.NET 2.0 is also used. The
database is a SQL Server Express database and not modified from the one created by Visual Studio
Express. However, to link the log on and the diary details, the UserName field in the DiaryDB database
takes its value originally from the membership database. You go through this in more detail shortly.
Membership details are contained in the ASPNETDB database that Visual Web Developer Express cre-
ates for you. Although it contains quite a few tables, you never access them via the code in this project.
It’s accessed exclusively by the new
Login controls — it does all the hard work behind the scenes!
This project only makes use of the aspnet_Users table, shown in Figure 1-11, to provide log on security
checking and provide a username for the main DiaryDB. You may well want to extend the membership
database to include extra functionality such as personalizing the user experience or providing different
levels of membership (admin, user, operator), among other things.
Figure 1-11
The tables of the main Online Diary database and their roles are listed in the following table:
Table Name Description
Diary Contains details of all Online Diary users, their DiaryId, and names.
DiaryEntry Contains all the diary entries for all diary users.
DiaryEvent Contains all the diary events for all diary users.
Contact Holds the details of all contacts for the diaries.
The key that links all of the tables together is the DiaryId field. It’s the primary key field in the Diary
table and a foreign key field in all the other tables. Why not use the UserName field? Basically speed—
it’s easier and therefore faster for the database to do joins and searches on an integer field than it is on
character-based fields.
All access to the database is via a stored procedure. The naming convention is simply as follows:
ActionThingThisActionRelatesTo
7
The Online Diary and Organizer
04_749516 ch01.qxp 2/10/06 9:11 PM Page 7