Tải bản đầy đủ (.pdf) (84 trang)

BeginningASP.NET 2.0 with C# PHẦN 10 pps

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.44 MB, 84 trang )

8. At the end of this installation, you should see the screen shown in Figure B-9, asking you to
restart your machine. You should oblige by clicking Restart Now.
By chance, you may not see this screen. As a general rule, you shouldn’t restart more often than neces-
sary, so if you’re not prompted to restart, don’t do it.
Figure B-9
9. After your machine has restarted, the dialog box depicted in Figure B-10 is displayed, notifying
you of a successful install (or any problems that were encountered) and reminding you to regis-
ter the software within 30 days.
Figure B-10
10. Click Exit and you will now be able to start up both Visual Web Developer and SQL Express.
SQL Server needs Internet access during installation, so make sure it can access the
Internet. Otherwise, the installation will fail.
653
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 653
Web Site Folder Setup
Next, set up the Websites folder with Windows Explorer, and create the folder C:\Websites\
WroxUnited
(or use whichever drive is appropriate to your setup).
IIS Setup (Optional)
As we’ve already mentioned, Visual Web Developer Express comes with its own web server: the
ASP.NET Development Server, nicknamed Cassini. However, some of you might want to use IIS any-
way. Note that it isn’t possible to run two versions of the web site concurrently, one on IIS and one on
the development server, because the database attaches itself to the ASP.NET Development Server and
you will find you can’t run it with IIS without detaching the database first.
To use IIS, you must have Windows XP Professional, Windows 2000, or Windows 2003 Server installed.
Windows XP Home Edition comes without IIS, and it isn’t possible to install it on Home Edition if you
do manage to get a copy of IIS. To begin the install, follow these steps:
1. To install IIS go to the Start menu, navigate to Settings➪Control Panel, and click Add or Remove
Programs. From the left-hand menu of the dialog box (shown in Figure B-11), select the
Add/Remove Windows Components icon. This will bring up the Windows Components


Wizard.
Figure B-11
2. Make sure the Internet Information Services option is selected, as shown in Figure B-12.
To create a folder in Windows Explorer, select File➪New Folder and type in the
name Websites.
654
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 654
Figure B-12
3. Click Details and you can select which of the options to install (see Figure B-13). You won’t need
all of the options, although you can install them separately at a later point. However, you must
make sure that you select the Common Files, the IIS snap-in, the Front Page Extensions, and the
World Wide Web Services options, because these are necessary to work with ASP.NET 2.0 and
Visual Web Developer Express.
Figure B-13
4. Click OK and make sure you have the Windows CD handy for the installation.
655
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 655
Create Alias
If you choose to install IIS and want to use the Wrox United sample web site on IIS, you will need to cre-
ate an alias so that IIS can recognize which application you mean and serve it accordingly. The following
steps walk you through creating an alias:
1. From the Start menu, select Run. Type MMC in the text box, and click OK. In the MMC dialog
box that appears, select File➪Add/Remove Snap In. Click the Add button and select IIS Internet
Information Services from the dialog box that appears, as depicted in Figure B-14.
Figure B-14
2. Expand the Internet Information Services, as shown in Figure B-15. Under that will be your
computer’s name. Expand that as well as the Web Sites option.
Figure B-15

656
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 656
3. Right-click Default Web Site, and select New➪Virtual Directory from the menu to start the wiz-
ard. Type WroxUnited as the Virtual Directory Name as in Figure B-16.
Figure B-16
4. Click Next and browse to C:\Websites\WroxUnited as the local path, as shown in Figure B-17.
Figure B-17
5. Click Next and make sure the boxes are selected as shown in Figure B-18. Then click Next.
657
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 657
Figure B-18
6. Click Finish. Close the MMC Console. A save is optional, and you can supply a name if you so
desire.
Wrox United Installation
Go to www.wrox.com and search for the dedicated page for Beginning ASP.NET 2.0 with C++ (ISBN:
0470042583). When you are there, you can download the Wrox United application, which comes as a
single downloadable zip file containing the database and application. Download the zip file and save it
to the
C:\Websites\WroxUnited folder you created earlier. Next, unzip this file to C:\Websites\.
It will automatically put files in the WroxUnited folder for you, so be careful not to extract it to
C:\Websites\WroxUnited, because you could end up with C:\Websites\WroxUnited\WroxUnited.
In Windows Explorer, make sure that inside your
C:\WebSites\WroxUnited is an App_Data folder
and that it has four files.
In particular, make sure that the following file names are present:

WroxUnited.mdf
❑ ASPNETDB.mdf

❑ WroxUnited_log.ldf
❑ ASPNETDB_log.ldf
If not, go back and try downloading the zip file again.
658
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 658
Network Service Enabling
The last step before you can test the application is that you might need to add Write permissions to the
Network Service account. This will allow ASP.NET to use the database and to read data from it and write
data to it, as is routinely required throughout the course of this book. You can skip this step if you are
using Windows Server 2003, because the Network Service account has these permissions already enabled
by default. If not, then you will almost certainly have to enable Write permissions first. Here’s how:
1. Go to Windows Explorer and select the C:\WebSites\WroxUnited\App_Data folder. Right-
click it and select Sharing and Security. Select the Security tab, shown in Figure B-19.
Figure B-19
If you can’t see the Security tab, this is because you have Simple File Sharing switched on. To
disable it, select Tools➪Folder Options from Windows Explorer, and select the View tab. Scroll
to the bottom and uncheck the Use Simple File Sharing option (see Figure B-20). If you can’t see
the Simple File Sharing option, this is because you have Windows XP Home Edition installed
and it has Simple File Sharing switched on permanently, and you cannot change it. Instead, you
will have to take another course as outlined in the next section.
659
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 659
Figure B-20
2. Click the Add button in the Wrox United Properties dialog box and in the Select Users or
Groups dialog box that appears. Type NETWORK SERVICE into the text box and click Check
Names. NETWORK SERVICE will become underlined, as shown in Figure B-21.
Figure B-21
If the machine is joined to a domain, you must select the Locations button first and

pick the current machine, rather than the domain. That’s because NETWORK SER-
VICE is an account on your machine. By default, the dialog will attempt to add the
domain name, rather than the machine name.
660
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 660
3. Click OK. You are returned to the Wrox United Properties dialog box. This time, select the new
NETWORK SERVICE option. Scroll down and check the box next to Write (see Figure B-22).
Click Apply, and then click OK.
Figure B-22
This will enable your account to access the database.
Windows XP Home Edition Users Only
If, when you come to browse for a Security tab in Windows Explorer, you can’t find one, this is because you
have Windows XP Home Edition installed and you have a slightly more complex route to enable the cor-
rect permissions. Apparently, Windows XP Home Edition users just aren’t allowed to have the same kind
of power as their XP Professional counterparts. To get around this, restart your computer in Safe Mode.
To do this, restart your machine, and before the Windows XP logo appears, hold down the F8 key and
select Safe Mode. Let XP continue and then log in as Administrator. You’ll receive a warning about run-
ning in Safe Mode, but click Yes anyway. Locate the C:\WebSites\WroxUnited folder in Windows
Explorer and right-click the
App_Data folder. Select Properties and select the Security tab that has now
appeared. Now go back to step 1 in the previous section and follow the instructions from there on. At the
end, though, shut down and restart your machine in normal mode before you continue to the next step.
Checking the Installation with VWD and the ASP.NET
Development Server
After you have successfully downloaded the Wrox United zip file, unzipped it, and enabled the
Network Service, you are ready to check your installation. Follow these steps:
661
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 661

1. Select the Start menu and navigate to All Programs. Select the Visual Web Developer 2005
Express Edition Icon at the bottom of the menu. VWD will open.
2. Select File➪Open Web Site, and browse to C:\Websites\WroxUnited and click Open. When the
web site has loaded into Solution Explorer, double-click
default.aspx to open the file. Press
the F5 key to run the page and observe it in a browser. You should see what appears in Figure
B-23 in your browser.
Figure B-23
Checking the Installation with IIS
Follow this step only if you have installed IIS and intend to use it as your main web server. To open
WroxUnited with IIS, start Internet Explorer and type http://localhost/WroxUnited into the Address line.
The web site should start and display what’s shown in Figure B-24.
Please note that while Figure B-22 is seemingly identical to Figure B-21, the Address line reveals a small
difference. If you are running your site on ASP.NET Development Server (the free web server with
VWD), you will get the following line (potentially with a different number):
http://localhost:1231/WroxUnited
This indicates that the web server is running on port 1231. The ASP.NET Development Server will arbitrar-
ily assign a port number in the URL. If you are running the web site on IIS, then you see the following line:
http://localhost/WroxUnited
662
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 662
Figure B-24
IIS by default runs on port 80, and this doesn’t need to be specified in the URL.
Occasionally, if port 80 is taken by another process, IIS will default to
http://localhost:8080, or you
might have to specify it yourself if you get an error message saying
Unexpected error 0x8ffe2740
occurred
.

This means that another application is using port 80. To alter this, you need to start the IIS manager from
Administrative Tools in the Control Panel, right-click the Default Web site in the left panel, and select
Properties. From the Web Site tab, change the number there from 80 to 8080, or if 8080 is taken then 8081,
or the first one free above that number.
Troubleshooting
By and large, installation with SQL Express and the ASP.NET development is straightforward. However,
if you are trying to use SQL Server 2005 rather than SQL Express, you should run through the following
extra steps:
1. Add [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as logins, substituting
machine with your machine name.
2. Attach the database (wroxunited.mdf), making ASPNET the db_owner.
3. Add [machine\ASPNET] and [NT AUTHORITY\NETWORK SERVICE] as database users.
4. Change the connection strings in web.config. That should be all for the WroxUnited database.
Then there’s the providers, which can be added to either the WroxUnited database or to a sepa-
rate one.
663
Setup
21_042583 appb.qxd 4/4/06 2:54 PM Page 663
5. Run aspnet_regsql (in the framework directory), to add user/roles/etc tables/procs to
the appropriate database.
6. Add provider sections in web.config, for <membership>, <roles>, and <profile>, setting
the default provider for each to the new provider added. These providers should point at the
ConnectionString for the database (which will be either WroxUnited or a new connection string
if you’re using another database).
Note that if you are using a different version of SQL Server than 2005, it isn’t possible to just attach the
database to the different version. If you are using the full version of 2005 and you encounter the following
problem:
Server Error in ‘/WroxUnited’ Application.
Failed to generate a user instance of SQL Server due to a failure in copying
database files. The connection will be closed.

Description: An unhandled exception occurred during the execution of the current
web request. Please review the stack trace for more information about the error and
where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Failed to generate a user
instance of SQL Server due to a failure in copying database files. The connection
will be closed.
you will need to do the following:
1. Reboot windows.
2. Log in as Administrator (if you aren’t running with Admin privileges).
3. Delete the C:\Documents and Settings\username\Local Settings\Application Data\
Microsoft\Microsoft SQL Server Data\SQLEXPRESS
directory.
You might need to logout and log back in as a “normal” user if you normally run with non-admin privileges.
If this doesn’t work, try the following solution —there is a known problem with remote logging on and
SQL Express, which the following steps should circumvent:
1. Go to the SQL Configuration Manager.
2. Right-click SQL Express and select Properties.
3. From the Logon tab, change the account from Network Service to Local System.
4. Try to run it again.
Apart from that, if you encounter a problem go to
or
and check to see if your problem is addressed there.
664
Appendix B
21_042583 appb.qxd 4/4/06 2:54 PM Page 664
C
Wrox United
Database Design
Throughout this book, you’ve seen examples based on the fictional Wrox United soccer team web
site. The application relies on a SQL Server database, supplied with the code downloads for this

book (available at
www.wrox.com). This database stores details of the players in the team, fixtures
and results, news items, orders from the shop, and so on.
This appendix is not intended to provide a thorough overview of database design principles, and
as such, we recommend that you read Wrox’s Beginning Database Design.
The database schema looks like Figure C-1.
Figure C-1
22_042583 appc.qxd 4/4/06 2:54 PM Page 665
This diagram illustrates the tables that exist within the database, and the relationships between those
tables. For example, players score goals, goals are scored at fixtures, match reports are written about spe-
cific fixtures, and so on. Many tables relate to other tables in the database, but there are some tables that
stand on their own; for example, the News table, which stores news articles. This table doesn’t link to
data stored in any other table. Notice also that the Orders, Products, and OrderLines tables are separate
from the rest of the database —these tables are used to store data relating to orders from the Wrox
United shop.
This appendix walks through the structure of each of the tables in the database and describes the rela-
tionships between them.
Players and Matches
The players on the Wrox United team are involved in many fixtures, and several related tables in the
database store related data for matches. Take a look at these tables first.
The Players Table
The following shows the structure of the Players table.
Field Data Type Allow Nulls
PlayerID (Primary Key) int No
FirstName varchar(25) No
LastName varchar(25) No
Position varchar(50) Yes
PictureURL varchar(255) Yes
DateJoined datetime Yes
DateLeft datetime Yes

This table is typical of all database tables in that it has the following:
❑ A primary key field that uniquely identifies each row in the database
❑ Fields designed to store textual data about each player (in
varchar fields)
❑ Fields that store date and time information
❑ Flags indicating whether or not different fields require values
In this table, the primary key is the PlayerID field, which stores numeric values (integers) that are
unique to each player in the database. This field, along with the FirstName and LastName fields, is
marked as not allowing null values. In other words, if you enter a row of data in the table, you must
666
Appendix C
22_042583 appc.qxd 4/4/06 2:54 PM Page 666
enter values for each of these fields. However, the PlayerID field will be filled with an auto-generated
number for you (due to the way it is configured), so the only data you must enter when you create a new
row is the full name of the new player. The remaining information describing the player is optional. You
don’t have to specify which position the player occupies, and you don’t have to specify when he or she
joined.
Note that a
varchar field is a field that stores character data of varying length. The number in brackets
is the maximum number of characters that can be stored in that field. If the field contains less than the
maximum length, it occupies less space in the database. A
char field, by comparison, always takes up
the same size in the database, no matter how much of the available space is filled with data.
Figure C-2 shows an example of some data from the Players table.
Figure C-2
This screenshot comes straight from Visual Web Developer. You can right-click any database table in the
Database Explorer and select Show Table Data to try this out for yourself.
The Goals Table
The Goals table relates directly to the Players table, because players score goals during a match. The fol-
lowing shows the structure of the Goals table.

667
Wrox United Database Design
22_042583 appc.qxd 4/4/06 2:54 PM Page 667
Field Data Type Allow Nulls
GoalID (Primary Key) int No
FixtureID (Foreign Key) int Yes
PlayerID (Foreign Key) int Yes
Time int Yes
Notice that one of the fields in this table is the PlayerID field, which will store an integer value corre-
sponding to the ID of one of the players in the Players table, so if Dave Dickenson scored the first goal
for Wrox United, the goal in the table with GoalID of 1 will have a PlayerID of 4. Dave could later score
another goal for Wrox United, so another record in the Goal table would be created with another unique
value for GoalID, but with the same PlayerID. This type of field is called a foreign key because it relates
directly to a primary key in another table.
There is another field in the Goals table for storing ID values, which is the FixtureID field. This links
each goal to a particular fixture. Because players could score many goals at a single fixture, the relation-
ship between the Fixtures table and the Goals table is similar to that of the Players table and the Goals
table.
The Fixtures Table
The Fixtures table is structured as shown here.
Field Data Type Allow Nulls
FixtureID (Primary Key) int No
FixtureDate datetime No
FixtureType varchar(10) Yes
GoalsFor smallint Yes
GoalsAgainst smallint Yes
Notes text Yes
Opponents varchar(50) No
For each match played by the Wrox United team, there is an entry in the Fixtures table. Because fixtures
can be arranged several months in advance, the fixture date has to be entered as soon as the fixture is

arranged, and the opponents have to be entered. The number of goals scored can be entered later, after
the match has been played.
This sort of relationship —where one fixture can contain many goals, or where one
player could score many goals —is known as a one-to-many relationship.
668
Appendix C
22_042583 appc.qxd 4/4/06 2:54 PM Page 668
The MatchReports Table
After each match has taken place, it’s up to the reporters to write up the details of the match so that fans
can read all about it later. These reports are stored in the MatchReports table, which is structured like as
shown here.
Field Data Type Allow Nulls
ReportID (Primary Key) int No
FixtureID (Foreign Key) int No
Report text Yes
MemberName varchar(50) No
This table also links to the Fixtures table by including a FixtureID field in this table, linking a match
report to a specific fixture. The MemberName field stores the name of the reporter.
The Gallery Table
The Gallery table is used to store details of pictures uploaded by fan club members. The fields defined in
this table are shown here.
Field Data Type Allow Nulls
PictureID (Primary Key) int No
FixtureID (Foreign Key) int Yes
UploadedByMemberName varchar(50) Yes
Notes text Yes
PictureURL varchar(50) No
Each picture can relate to a specific fixture (notice the FixtureID field); however, because this field allows
the use of null values, this implies that pictures do not necessarily have to relate to fixtures.
Standalone Tables

The two standalone tables in the database are the Opponents table and the News table.
The Opponents Table
The Opponents table stands on its own in the database, and is defined as shown here.
The reason the Opponents table is on its own is a bit unfortunate, but the opposing team may decide to
change its name at some point in the future, which would change the name of all fixtures that Wrox
United played against them in the past if they were related. By keeping the tables separate, and only
using a name for each team, the name of the opponent in any particular match is preserved.
669
Wrox United Database Design
22_042583 appc.qxd 4/4/06 2:54 PM Page 669
Field Data Type Allow Nulls
OpponentID (Primary Key) int No
Name varchar(50) Yes
Won int Yes
Drawn int Yes
Lost int Yes
Points int Yes
TotalGoalsFor int Yes
TotalGoalsAgainst int Yes
This table can be updated with results of matches to maintain a tally of how well the Wrox United team
is performing in the league.
The News Table
The News table, described here, contains all of the news stories from the front page of the Wrox United site.
Field Data Type Allow Nulls
NewsID (Primary Key) Int No
DateToShow datetime No
Description text Yes
PictureURL varchar(50) Yes
Category varchar(50) Yes
Title varchar(50) Yes

Notice that each news item requires that a date be entered for each story, so that a story can remain hid-
den until a certain date has passed.
Wrox United Store Tables
The online shopping experience on the Wrox United site relies on data stored in three tables: the Orders
table, the Products table, and the OrderLines table. These tables are heavily reliant on each other.
The Orders Table
The Orders table, described here, contains a unique ID containing the main order details for an order.
670
Appendix C
22_042583 appc.qxd 4/4/06 2:54 PM Page 670
Field Data Type Allow Nulls
OrderID (Primary Key) Int No
OrderDate datetime No
OrderSentDate datetime Yes
MemberName varchar(50) No
Name varchar(50) No
Address varchar(255) No
County varchar(50) No
PostCode varchar(15) No
Country nchar(10) No
SubTotal money Yes
Discount money Yes
Total money Yes
In this table, you’ll notice that most of the fields are marked as mandatory (not allowing null values).
This highlights the fact that orders must have full address details before an order can be fulfilled. A cou-
ple of less familiar field types are in here too. The
nchar data type will always take up 10 characters
space in the database, and the
n in the name indicates that the data stored could contain Unicode charac-
ters. The other unfamiliar data type is

money, which (as the name implies) can be used to store monetary
values.
Notice that there are no details in this table about which products have been bought in a particular
order. This information is stored in the OrderLines table.
The OrderLines Table
The OrderLines table, described here, links the Products table to the Orders table, indicating which items
have been bought in a particular order.
Field Data Type Allow Nulls
OrderLineID (Primary Key) int No
OrderID (Foreign Key) int No
ProductID (Foreign Key) int No
Quantity smallint No
Price money No
671
Wrox United Database Design
22_042583 appc.qxd 4/4/06 2:54 PM Page 671
Because an order can contain one or many products, there is a foreign key link here to the Products table.
However, because many different orders can be for the same product, there is also a foreign key link here
to the Orders table. This means that an individual line in this table stores details of one item, and one
order number. If you order more than one of a specific product, the Quantity is increased for the order
line, but you won’t end up with a new OrderLineID.
The Products Table
The Products table, described here, contains details of all of the products that can be bought from the
shop.
Field Data Type Allow Nulls
ProductID (Primary Key) int No
Name varchar(50) No
Description varchar(255) Yes
Price money No
PictureURL varchar(255) Yes

This simple table provides data about products, and is used both when users are browsing the shop and
when they’re buying items from the shop.
The relationship between the Orders table and the Products table is a many-to-many
relationship. In this situation, there has to be a central table that has one-to-many
relationships to both tables, and this is called the Join table.
672
Appendix C
22_042583 appc.qxd 4/4/06 2:54 PM Page 672
D
VWD Database Explorer
When you’re designing pages that work with data, you frequently need to check the metadata, for
example, to confirm the data type of a field. You also want to test your pages by quickly modifying
the data in tables. Furthermore, in some cases, you want to add a small and simple table to a
database, such as a list of shippers. In the past, these database tasks required that you leave your
web editor to open a second window with a database management tool. Visual Web Developer
offers a built-in tool named the Database Explorer that can perform these tasks without the need
for a separate management tool. Some functions are performed directly and others invoke a wiz-
ard to step you through the task.
This appendix covers the various techniques for working with the Database Explorer.
Opening the Database Explorer
You can view the Database Explorer either by choosing Menu➪View or by pressing Ctrl+Alt+S.
After it is open, the Database Explorer by default stacks on top of the Solution Explorer on the
right side of the screen. You can move it to a new dock location by dragging its title bar.
Adding an Existing Database to the
Database Explorer
The technique to connect the Database Explorer to a database depends on the type of database.
The following three sections cover the Microsoft databases. Most other databases (such as Oracle
or MySQL) will be the same as connecting to a SQL Server.
If you mess up the layout, you can return to the default by choosing
Menu➪Windows➪Reset Windows Layout.

23_042583 appd.qxd 4/4/06 4:23 PM Page 673
Accessing Files
Follow these steps:
1. On the Database Explorer toolbar, click Connect to Database, and from the first page of the wiz-
ard, select Microsoft Access Database File, as shown in Figure D-1.
Figure D-1
2. Browse to the file, and then add logon information if needed (see Figure D-2).
Figure D-2
3. You have the option to test the connection and then it is added to your list in the Database
Explorer.
674
Appendix D
23_042583 appd.qxd 4/4/06 4:23 PM Page 674
SQL Databases on a SQL Server (Including SQL Server
Express)
Follow these steps:
1. On the Database Explorer toolbar, click Connect to Database, and in the first page of the wizard
(shown in Figure D-3), select Microsoft SQL Server.
Figure D-3
In the next dialog box, the Data Source section is locked— it actually means the kind of data
source, not the name of the database.
2. Continuing on the Add Connection screen, for the Server Name text box, there are two options.
If you are using a full install of SQL Server, select the server name. If you are using SQL Server
Express (as we do in this book), type the following syntax exactly: (local)\SQLExpress, as
shown in Figure D-4.
Figure D-4
675
VWD Database Explorer
23_042583 appd.qxd 4/4/06 4:23 PM Page 675
Note the potential confusion when using SQL Server Express. Your PC name will be listed in the

drop-down box of servers, but that is not the server you want to specify. You must type into the
server name box the specific syntax to point to your local machine’s instance of SQL Server
Express.
3. Keep the choice for logon information set to Windows (see Figure D-5) unless you have devel-
oped an authentication table in SQL Server.
Figure D-5
4. After you have selected the server name, you can drop down the list of databases. Test the con-
nection and then click Finish to see your new data connection.
Saving SQL Databases as an MDF File
For highest performance, data is kept in SQL Server without an external file structure. But for portability,
a database can be configured to save its data in a Windows file that can be copied to a new server. The
file will have an extension of .mdf. We use an .mdf file to distribute data in this book. (The alternative
would be to have you download a long SQL script that would build the entire database internally in
your server and populate its data.) Connecting to an .mdf file is very similar to connecting to Access
Files. Just follow these steps:
1. On the Database Explorer toolbar, click Connect to Database, and select Microsoft SQL Server
Database File, as shown in Figure D-6.
Figure D-6
2. Browse to the file and add logon information if needed (see Figure D-7).
3. You have the option to test the connection and then it is added to your list in the Database Explorer.
676
Appendix D
23_042583 appd.qxd 4/4/06 4:23 PM Page 676
Figure D-7
Viewing Database Diagrams
The VWD Database Explorer provides a visual presentation of your database’s objects along with the
capability to drill down into each object’s properties. Follow these steps to walk through a diagram of
your database:
1. Within the Database Explorer, expand your Data Connections and then expand your database.
When you expand the Database Diagrams (see Figure D-8) the first time, you may be asked to

establish yourself as the dbo (database owner). Click Yes. Right-click the Database Diagram object
and add a new diagram. If asked, accept the creation of elements needed to build the diagram.
Figure D-8
677
VWD Database Explorer
23_042583 appd.qxd 4/4/06 4:23 PM Page 677

×